22 lines
531 B
TypeScript
22 lines
531 B
TypeScript
import { Redirect } from 'expo-router';
|
|
import { ActivityIndicator, View } from 'react-native';
|
|
import { useAuth } from '@/context/AuthContext';
|
|
|
|
export default function Index() {
|
|
const { initialized, session } = useAuth();
|
|
|
|
if (!initialized) {
|
|
return (
|
|
<View className="flex-1 items-center justify-center bg-slate-50">
|
|
<ActivityIndicator size="large" color="#1D4ED8" />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
if (session?.user) {
|
|
return <Redirect href="/(tabs)" />;
|
|
}
|
|
|
|
return <Redirect href="/auth/login" />;
|
|
}
|