deguapp/frontend/app/(app)/_layout.js

27 lines
671 B
JavaScript

import { Redirect, Stack, Slot } from "expo-router";
import { useAuth } from "@context/AuthContext";
import { View, Text, StyleSheet } from "react-native";
import { StatusBar } from "expo-status-bar";
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>
);
}
if (!authState.authenticated) {
console.log("get the fuck out");
return <Redirect href="/login" />;
}
return (
<Stack>
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
</Stack>
);
}