1
0
forked from fr/deguapp
deguapp/frontend/app/(app)/_layout.js

28 lines
628 B
JavaScript
Raw Normal View History

import { Redirect, Stack, Slot } from "expo-router";
import { useAuth } from "@context/AuthContext";
import { View, Text, StyleSheet } from "react-native";
export default function AppLayout() {
const { authState } = useAuth();
if (authState.authenticated === null) {
// micro loading co neni skoro videt ale get the fuck out se uz neloguje
return (
<View>
<Text>Loading...</Text>
</View>
);
}
2024-05-08 23:39:49 +02:00
if (!authState.authenticated) {
console.log("get the fuck out");
return <Redirect href="/login" />;
}
2024-05-08 23:39:49 +02:00
return (
<Stack>
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
</Stack>
);
}