Skip to content

Commit

Permalink
Merge pull request #76 from VipinVIP/main
Browse files Browse the repository at this point in the history
Fix unable to fetch
  • Loading branch information
anandbaburajan authored Feb 2, 2021
2 parents 16b19e8 + 0937933 commit 927b5d0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/components/PollsList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState, useCallback } from "react";
import { useEffect, useState } from "react";
import NProgress from "nprogress";
import { Trash } from "react-bootstrap-icons";
import { useSelector } from "react-redux";
Expand Down Expand Up @@ -35,7 +35,7 @@ const PollsList = (): JSX.Element => {
const [modalShow, setModalShow] = useState<boolean>(false);
const [id, setId] = useState<string>("");

const getData = useCallback(async (): Promise<void> => {
const getData = async (): Promise<void> => {
try {
NProgress.start();
const fetchedPolls = await serverAPI.getPolls({
Expand All @@ -56,12 +56,11 @@ const PollsList = (): JSX.Element => {
setMessage("Unable to fetch polls. Check your connection.");
NProgress.done();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

};
useEffect(() => {
getData();
}, [getData]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const handleDelete = async (pollID: string): Promise<void> => {
try {
Expand Down

1 comment on commit 927b5d0

@vercel
Copy link

@vercel vercel bot commented on 927b5d0 Feb 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.