diff --git a/app/(application)/home.tsx b/app/(application)/home.tsx index a568b21..d56537e 100644 --- a/app/(application)/home.tsx +++ b/app/(application)/home.tsx @@ -22,8 +22,8 @@ import { useDispatch, useSelector } from "react-redux"; export default function Home() { const entities = useSelector((state: any) => state.entities) const dispatch = useDispatch() - const { token, decryptToken } = useAuthSession() - const insets = useSafeAreaInsets(); + const { token, decryptToken, signOut } = useAuthSession() + const insets = useSafeAreaInsets() useEffect(() => { handleUserLogin() @@ -31,7 +31,11 @@ export default function Home() { async function handleUserLogin() { const hasil = await decryptToken(String(token?.current)) - apiGetProfile({ id: hasil }).then((data) => dispatch(setEntities(data.data))); + apiGetProfile({ id: hasil }) + .then((data) => dispatch(setEntities(data.data))) + .catch((error) => { + signOut() + }); } return (