diff --git a/front/App.tsx b/front/App.tsx index f3c5996..c9ba014 100644 --- a/front/App.tsx +++ b/front/App.tsx @@ -1,18 +1,21 @@ -import { NavigationContainer } from '@react-navigation/native'; import { Provider as PaperProvider } from 'react-native-paper'; import Theme from './Theme'; -import { Stack, protectedRoutes, publicRoutes } from './Navigation'; +import React from 'react'; +import { QueryClient, QueryClientProvider } from 'react-query'; +import { Provider } from 'react-redux'; +import store from './state/Store'; +import { Router } from './Navigation'; -const isAuthentified = true; +const queryClient = new QueryClient(); export default function App() { return ( - - - - { isAuthentified ? protectedRoutes : publicRoutes } - - - + + + + + + + ); } diff --git a/front/Navigation.tsx b/front/Navigation.tsx index e32c4b8..643f20f 100644 --- a/front/Navigation.tsx +++ b/front/Navigation.tsx @@ -1,13 +1,27 @@ import { createNativeStackNavigator } from '@react-navigation/native-stack'; import React from 'react'; +import AuthenticationView from './views/AuthenticationView'; import HomeView from './views/HomeView'; +import { NavigationContainer } from '@react-navigation/native'; +import { useSelector } from 'react-redux'; -export const Stack = createNativeStackNavigator(); +const Stack = createNativeStackNavigator(); export const protectedRoutes = ; export const publicRoutes = + +; -; \ No newline at end of file +export const Router = () => { + const isAuthentified = useSelector((state) => state.user.token !== undefined) + return ( + + + {isAuthentified ? protectedRoutes : publicRoutes} + + + ) +} \ No newline at end of file