-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.jsx
51 lines (48 loc) · 1.59 KB
/
App.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
import { useEffect, useState } from 'react';
import Product from './pages/product';
import Pricing from './pages/Pricing';
import Homepage from './pages/Homepage';
import PageNotFound from './pages/PageNotFound';
import './index.module.css';
import AppLayout from './pages/AppLayout';
import Login from './pages/Login';
import CityList from './components/CityList';
import CountriesList from './components/CountryList';
import City from './components/City';
import Form from './components/Form';
import CitiesProvider from './contexts/CitiesContext';
import AuthProvider from './contexts/FakeAuthContext';
import ProtectedRoute from './pages/ProtectedRoute';
function App() {
return (
<AuthProvider>
<CitiesProvider>
<BrowserRouter>
<Routes>
<Route path='/' element={<Homepage />} />
<Route path='product' element={<Product />} />
<Route path='pricing' element={<Pricing />} />
<Route path='login' element={<Login />} />
<Route
path='app/'
element={
<ProtectedRoute>
<AppLayout />
</ProtectedRoute>
}
>
<Route index element={<Navigate to='cities' replace />} />
<Route path='cities' element={<CityList />} />
<Route path='cities/:id' element={<City />} />
<Route path='countries' element={<CountriesList />} />
<Route path='form' element={<Form />} />
</Route>
<Route path='*' element={<PageNotFound />} />
</Routes>
</BrowserRouter>
</CitiesProvider>
</AuthProvider>
);
}
export default App;