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/index.tsx | |
| parent | 95cc9e6ff29cd39dc80aa09c80a6d1c9489b5d6a (diff) | |
| download | karakeep-2cd2f92e9e0c82eaa5f21fe0c30e20ebea7aba24.tar.zst | |
fix(mobile): Fix setting propagatin
Diffstat (limited to 'apps/mobile/app/index.tsx')
| -rw-r--r-- | apps/mobile/app/index.tsx | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/apps/mobile/app/index.tsx b/apps/mobile/app/index.tsx index f075fd6d..235b19e4 100644 --- a/apps/mobile/app/index.tsx +++ b/apps/mobile/app/index.tsx @@ -1,19 +1,16 @@ -import { useEffect } from "react"; -import { View } from "react-native"; -import { useRouter } from "expo-router"; -import { useSession } from "@/lib/session"; +import { useIsLoggedIn } from "@/lib/session"; +import { Redirect } from "expo-router"; +import FullPageSpinner from "@/components/ui/FullPageSpinner"; export default function App() { - const router = useRouter(); - const { isLoggedIn } = useSession(); - useEffect(() => { + const isLoggedIn = useIsLoggedIn(); + if (isLoggedIn === undefined) { // Wait until it's loaded + return <FullPageSpinner />; } else if (isLoggedIn) { - router.replace("dashboard"); + return <Redirect href="dashboard" /> } else { - router.replace("signin"); + return <Redirect href="signin" /> } - }, [isLoggedIn]); - return <View />; } |
