diff --git a/src/pages/mine.tsx b/src/pages/mine.tsx index 3e08fa501..eb12a837c 100644 --- a/src/pages/mine.tsx +++ b/src/pages/mine.tsx @@ -21,6 +21,7 @@ function CardList(tasks: task[]) { ); } + const Mine: FC = () => { const [tasks, setTasks] = useState([]); const { @@ -32,12 +33,11 @@ const Mine: FC = () => { const { state } = useAppContext(); const { isLoading: isAuthenticating, isLoggedIn } = state; useEffect(() => { - if (isLoggedIn && !Object.keys(response).length) { - callAPI(); - setTasks(response); + if (isLoggedIn) { + if (JSON.stringify(response) === "{}") callAPI(); + if (JSON.stringify(response) !== "{}") setTasks(response); } }, [isLoggedIn, response]) - return ( @@ -51,11 +51,12 @@ const Mine: FC = () => {

Something went wrong! Please contact admin

) : ( <> - {tasks.length > 0 ? ( -
{CardList(tasks)}
- ) : ( -

No Tasks Found

- )} + { + tasks.length > 0 &&
{CardList(tasks)}
+ } + { + response?.length == 0 && tasks.length == 0 &&

No Tasks Found

+ } ) ) : (