eee8eb98cd9e9cf9ee9ace1609a786e0e39e7480
import { Redirect } from 'expo-router';
import { useAuth } from '@/context/AuthContext';
import { ActivityIndicator, View } from 'react-native';
export default function Index() {
const { isAuthenticated, isLoading, user } = useAuth();
let url = "/auth/login";
if (isLoading) {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<ActivityIndicator size="large" />
</View>
);
}
if (isAuthenticated) {
if (user.active) {
url = "/(tabs)/new"
} else {
url = "/auth/activate"
return <Redirect href={url} />;