diff options
| author | MohamedBassem <me@mbassem.com> | 2024-03-22 15:10:24 +0000 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-03-22 15:14:24 +0000 |
| commit | 2cd2f92e9e0c82eaa5f21fe0c30e20ebea7aba24 (patch) | |
| tree | acf86f033b976a40079c3efe8ec1fb727ae2a452 /apps/mobile/app/dashboard/_layout.tsx | |
| parent | 95cc9e6ff29cd39dc80aa09c80a6d1c9489b5d6a (diff) | |
| download | karakeep-2cd2f92e9e0c82eaa5f21fe0c30e20ebea7aba24.tar.zst | |
fix(mobile): Fix setting propagatin
Diffstat (limited to 'apps/mobile/app/dashboard/_layout.tsx')
| -rw-r--r-- | apps/mobile/app/dashboard/_layout.tsx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/mobile/app/dashboard/_layout.tsx b/apps/mobile/app/dashboard/_layout.tsx index bb14a203..ef04fcd1 100644 --- a/apps/mobile/app/dashboard/_layout.tsx +++ b/apps/mobile/app/dashboard/_layout.tsx @@ -1,6 +1,18 @@ +import { useIsLoggedIn } from "@/lib/session"; +import { useRouter } from "expo-router"; import { Stack } from "expo-router/stack"; +import { useEffect } from "react"; export default function Dashboard() { + const router = useRouter(); + + const isLoggedIn = useIsLoggedIn(); + useEffect(() => { + if (isLoggedIn !== undefined && !isLoggedIn) { + return router.replace("signin"); + } + }, [isLoggedIn]); + return ( <Stack> <Stack.Screen |
