eletrotupi / tcc/ frontend/app/index.tsx163ef8bd45b150acdd76d5452ff2219269dcd15b
495 B | 17 lines Raw
1
import { Redirect } from 'expo-router';
2
import { useAuth } from '@/context/AuthContext';
3
import { ActivityIndicator, View } from 'react-native';
4

5
export default function Index() {
6
  const { isAuthenticated, isLoading } = useAuth();
7

8
  if (isLoading) {
9
    return (
10
      <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
11
        <ActivityIndicator size="large" />
12
      </View>
13
    );
14
  }
15

16
  return <Redirect href={isAuthenticated ? '/(tabs)/new' : '/auth/login'} />;
17
}