aboutsummaryrefslogtreecommitdiffstats
path: root/packages/mobile/app/index.tsx
blob: 5ce20cdaba45b3abaa1aabac600f2fb4c35ff89c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { useRouter } from "expo-router";
import { useEffect } from "react";
import { View } from "react-native";

import { useSession } from "@/lib/session";

export default function App() {
  const router = useRouter();
  const { isLoggedIn } = useSession();
  useEffect(() => {
    if (isLoggedIn === undefined) {
      // Wait until it's loaded
    } else if (isLoggedIn) {
      router.replace("dashboard");
    } else {
      router.replace("signin");
    }
  }, [isLoggedIn]);
  return <View />;
}