2024-05-08 21:18:47 +02:00
|
|
|
import { Redirect, Stack, Slot } from "expo-router";
|
|
|
|
import { useAuth } from "@context/AuthContext";
|
|
|
|
import { View, Text, StyleSheet } from "react-native";
|
2024-05-06 22:18:22 +02:00
|
|
|
|
|
|
|
export default function AppLayout() {
|
2024-05-08 16:50:25 +02:00
|
|
|
const { authState } = useAuth();
|
2024-05-06 22:18:22 +02:00
|
|
|
|
2024-05-08 16:50:25 +02:00
|
|
|
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
|
|
|
|
2024-05-08 16:50:25 +02:00
|
|
|
if (!authState.authenticated) {
|
|
|
|
console.log("get the fuck out");
|
|
|
|
return <Redirect href="/login" />;
|
|
|
|
}
|
2024-05-08 23:39:49 +02:00
|
|
|
|
2024-05-08 21:18:47 +02:00
|
|
|
return (
|
|
|
|
<Stack>
|
|
|
|
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
|
|
</Stack>
|
|
|
|
);
|
2024-05-06 22:18:22 +02:00
|
|
|
}
|