eletrotupi / tcc/ frontend/app/index.tsxe11faebd227a1ab47246f3cf6d02d42cc42a6c8c
535 B | 19 lines Raw
1
import { Redirect } from "expo-router";
2
import { useAuth } from "@/context/AuthContext";
3
import { routeForStatus } from "@/context/authRouting";
4
import { ActivityIndicator, View } from "react-native";
5

6
export default function Index() {
7
  const { status, user } = useAuth();
8
  const href = routeForStatus(status, user);
9

10
  if (!href) {
11
    return (
12
      <View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
13
        <ActivityIndicator size="large" />
14
      </View>
15
    );
16
  }
17

18
  return <Redirect href={href} />;
19
}