22 lines
534 B
TypeScript
22 lines
534 B
TypeScript
import { useAuth } from '@/components/AuthProvider';
|
|
import { Redirect } from 'expo-router';
|
|
import { ActivityIndicator, View } from 'react-native';
|
|
|
|
export default function Index() {
|
|
const { isAuthenticated, isLoading } = useAuth();
|
|
|
|
if (isLoading) {
|
|
return (
|
|
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
|
<ActivityIndicator size="large" />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
if (isAuthenticated) {
|
|
return <Redirect href="/(dashboard)" />;
|
|
}
|
|
|
|
return <Redirect href="/(auth)" />;
|
|
}
|