From 171c5f0eeb1c616b66d943c391437a4cf72038c8 Mon Sep 17 00:00:00 2001 From: amaliadwiy Date: Wed, 27 Aug 2025 10:30:23 +0800 Subject: [PATCH] upd: ketika link api berubah Deskripsi: - jika pengembalian error maka otomatis signout pada halaman home NO Issues --- app/(application)/home.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 (