mirror of
https://github.com/Sosokker/chefhai.git
synced 2025-12-19 05:54:08 +01:00
24 lines
708 B
TypeScript
24 lines
708 B
TypeScript
import React from 'react';
|
|
import { View, ActivityIndicator } from 'react-native';
|
|
import { Redirect } from 'expo-router';
|
|
import { useAuth } from './context/auth-context';
|
|
|
|
export default function Index() {
|
|
const { isAuthenticated, isLoading } = useAuth();
|
|
|
|
// Show loading indicator while checking auth status
|
|
if (isLoading) {
|
|
return (
|
|
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center', backgroundColor: 'white' }}>
|
|
<ActivityIndicator size="large" color="#ffd60a" />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
// Redirect based on authentication status
|
|
if (isAuthenticated) {
|
|
return <Redirect href="/welcome" />;
|
|
} else {
|
|
return <Redirect href="/welcome" />;
|
|
}
|
|
} |