Initial Mobile
This commit is contained in:
41
mobile/app/index.tsx
Normal file
41
mobile/app/index.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
import { Redirect } from 'expo-router';
|
||||
import { ActivityIndicator, StyleSheet, Text, View } from 'react-native';
|
||||
|
||||
import { useAuth } from '@/src/providers/auth-provider';
|
||||
|
||||
export default function IndexScreen() {
|
||||
const { isBootstrapping, token, requiresTenantSelection } = useAuth();
|
||||
|
||||
if (isBootstrapping) {
|
||||
return (
|
||||
<View style={styles.centered}>
|
||||
<ActivityIndicator size="large" />
|
||||
<Text style={styles.copy}>Initialisiere mobile Session...</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
if (!token) {
|
||||
return <Redirect href="/login" />;
|
||||
}
|
||||
|
||||
if (requiresTenantSelection) {
|
||||
return <Redirect href="/tenant-select" />;
|
||||
}
|
||||
|
||||
return <Redirect href="/(tabs)" />;
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
centered: {
|
||||
flex: 1,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
gap: 12,
|
||||
padding: 24,
|
||||
},
|
||||
copy: {
|
||||
fontSize: 14,
|
||||
color: '#4b5563',
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user