18 lines
409 B
TypeScript
18 lines
409 B
TypeScript
import { Redirect } from 'expo-router';
|
|
import { useAuth } from '@/src/context/AuthContext';
|
|
import { Screen } from '@/src/components/Screen';
|
|
|
|
export default function Index() {
|
|
const { isAuthenticated, isLoading } = useAuth();
|
|
|
|
if (isLoading) {
|
|
return <Screen loading />;
|
|
}
|
|
|
|
if (isAuthenticated) {
|
|
return <Redirect href="/(main)/(tabs)" />;
|
|
}
|
|
|
|
return <Redirect href="/(auth)/login" />;
|
|
}
|