27 lines
No EOL
703 B
TypeScript
27 lines
No EOL
703 B
TypeScript
import { Redirect } from 'expo-router';
|
|
import { useStaffAuth } from '@/components/context/staff-auth-context';
|
|
import { View, ActivityIndicator } from 'react-native';
|
|
import { AppContainer } from 'common-ui';
|
|
|
|
export default function Index() {
|
|
const { isLoggedIn, isLoading } = useStaffAuth() ;
|
|
|
|
// Show loading while checking auth
|
|
if (isLoading) {
|
|
return (
|
|
<AppContainer>
|
|
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
|
<ActivityIndicator size="large" />
|
|
</View>
|
|
</AppContainer>
|
|
);
|
|
}
|
|
|
|
if(isLoggedIn){
|
|
return <Redirect href={'/(drawer)/dashboard'} />;
|
|
}
|
|
else {
|
|
return <Redirect href={'/login'} />;
|
|
}
|
|
|
|
} |