fix login check and urls
This commit is contained in:
@@ -1,64 +1,70 @@
|
||||
import {Tabs} from "expo-router";
|
||||
import {Ionicons} from "@expo/vector-icons";
|
||||
import { Tabs, Redirect } from "expo-router";
|
||||
import { Ionicons } from "@expo/vector-icons";
|
||||
import { useAuthStore } from "@/store/authStore";
|
||||
|
||||
export default function TabLayout() {
|
||||
return (
|
||||
<Tabs
|
||||
screenOptions={{
|
||||
tabBarActiveTintColor: "rgb(var(--color-primary-500))",
|
||||
}}
|
||||
>
|
||||
<Tabs.Screen
|
||||
name="index"
|
||||
options={{
|
||||
title: "Home",
|
||||
tabBarLabel: "Home",
|
||||
tabBarIcon: ({color, size}) => (
|
||||
<Ionicons name="home-outline" size={size} color={color}/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="notices"
|
||||
options={{
|
||||
title: "Ogłoszenia",
|
||||
tabBarLabel: "Ogłoszenia",
|
||||
tabBarIcon: ({color, size}) => (
|
||||
<Ionicons name="list-outline" size={size} color={color}/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="notice/create"
|
||||
options={{
|
||||
title: "Dodaj",
|
||||
tabBarLabel: "Dodaj",
|
||||
tabBarIcon: ({color, size}) => (
|
||||
<Ionicons name="add-circle-outline" size={size} color={color}/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="wishlist"
|
||||
options={{
|
||||
title: "Ulubione",
|
||||
tabBarLabel: "Ulubione",
|
||||
tabBarIcon: ({color, size}) => (
|
||||
<Ionicons name="heart-outline" size={size} color={color}/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="dashboard"
|
||||
options={{
|
||||
headerShown: false,
|
||||
title: "Konto",
|
||||
tabBarLabel: "Konto",
|
||||
tabBarIcon: ({color, size}) => (
|
||||
<Ionicons name="person-outline" size={size} color={color}/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</Tabs>
|
||||
);
|
||||
const token = useAuthStore((state) => state.token);
|
||||
|
||||
if (!token) {
|
||||
return <Redirect href="/login" />;
|
||||
}
|
||||
return (
|
||||
<Tabs
|
||||
screenOptions={{
|
||||
tabBarActiveTintColor: "rgb(var(--color-primary-500))",
|
||||
}}
|
||||
>
|
||||
<Tabs.Screen
|
||||
name="index"
|
||||
options={{
|
||||
title: "Home",
|
||||
tabBarLabel: "Home",
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<Ionicons name="home-outline" size={size} color={color} />
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="notices"
|
||||
options={{
|
||||
title: "Ogłoszenia",
|
||||
tabBarLabel: "Ogłoszenia",
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<Ionicons name="list-outline" size={size} color={color} />
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="notice/create"
|
||||
options={{
|
||||
title: "Dodaj",
|
||||
tabBarLabel: "Dodaj",
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<Ionicons name="add-circle-outline" size={size} color={color} />
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="wishlist"
|
||||
options={{
|
||||
title: "Ulubione",
|
||||
tabBarLabel: "Ulubione",
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<Ionicons name="heart-outline" size={size} color={color} />
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="dashboard"
|
||||
options={{
|
||||
headerShown: false,
|
||||
title: "Konto",
|
||||
tabBarLabel: "Konto",
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<Ionicons name="person-outline" size={size} color={color} />
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</Tabs>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user