|
1 | | -import { BrowserRouter, Route, Routes } from "react-router-dom"; |
| 1 | +import { useEffect, useState } from "react"; |
| 2 | +import { BrowserRouter, Navigate, Route, Routes } from "react-router-dom"; |
| 3 | + |
2 | 4 | import Homepage from "./pages/Homepage/Homepage"; |
3 | 5 | import Products from "./pages/Product/Products"; |
4 | 6 | import Pricing from "./pages/Product/Pricing"; |
5 | 7 | import Login from "./pages/Login/Login"; |
6 | 8 | import AppLayout from "./pages/AppLayout/AppLayout"; |
7 | 9 | import PageNotFound from "./pages/PageNotFound"; |
8 | 10 | import CityList from "./components/City/CityList"; |
9 | | -import { useEffect, useState } from "react"; |
| 11 | +import CountryList from "./components/Country/CountryList"; |
| 12 | +import City from "./components/City/City"; |
| 13 | +import Form from "./components/Form/Form"; |
10 | 14 |
|
11 | 15 | const BASE_URL = "http://localhost:9000"; |
12 | 16 |
|
@@ -35,20 +39,21 @@ const App = () => { |
35 | 39 | <BrowserRouter> |
36 | 40 | <Routes> |
37 | 41 | <Route index element={<Homepage />} /> |
38 | | - <Route path="/products" element={<Products />} /> |
39 | | - <Route path="/pricing" element={<Pricing />} /> |
40 | | - <Route path="/login" element={<Login />} /> |
41 | | - <Route path="/app" element={<AppLayout />}> |
| 42 | + <Route path="products" element={<Products />} /> |
| 43 | + <Route path="pricing" element={<Pricing />} /> |
| 44 | + <Route path="login" element={<Login />} /> |
| 45 | + <Route path="app" element={<AppLayout />}> |
| 46 | + <Route index element={<Navigate replace to="cities" />} /> |
42 | 47 | <Route |
43 | | - index |
| 48 | + path="cities" |
44 | 49 | element={<CityList cities={cities} isLoading={isLoading} />} |
45 | 50 | /> |
| 51 | + <Route path="cities/:id" element={<City />} /> |
46 | 52 | <Route |
47 | | - path="cities" |
48 | | - element={<CityList cities={cities} isLoading={isLoading} />} |
| 53 | + path="countries" |
| 54 | + element={<CountryList cities={cities} isLoading={isLoading} />} |
49 | 55 | /> |
50 | | - <Route path="countries" element={<p>Countries</p>} /> |
51 | | - <Route path="form" element={<p>Form</p>} /> |
| 56 | + <Route path="form" element={<Form />} /> |
52 | 57 | </Route> |
53 | 58 | <Route path="*" element={<PageNotFound />} /> |
54 | 59 | </Routes> |
|
0 commit comments