-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.jsx
84 lines (76 loc) · 2.66 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { BrowserRouter, Navigate, Route, Routes } from "react-router-dom";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import { Toaster } from "react-hot-toast";
import GlobbalStyles from "./styles/GlobalStyles";
import { DarkMode } from "./context/DarkModeContext";
import Dashboard from "./pages/Dashboard";
import Login from "./pages/Login";
import Bookings from "./pages/Bookings";
import Cabins from "./pages/Cabins";
import Settings from "./pages/Settings";
import Account from "./pages/Account";
import Users from "./pages/Users";
import PageNotFound from "./pages/PageNotFound";
import Booking from "./pages/Booking";
import Checkin from "./pages/Checkin";
import AppLayout from "./ui/AppLayout";
import ProtectedRoute from "./ui/ProtectedRoute";
const queryClient = new QueryClient({
defaultOptions: {
queries: {
// staleTime: 60 * 1000, 1mins
staleTime: 0, //always keep data fetching to in sync
},
},
});
function App() {
return (
<DarkMode>
<QueryClientProvider client={queryClient}>
<ReactQueryDevtools />
<GlobbalStyles />
<BrowserRouter>
<Routes>
<Route
element={
<ProtectedRoute>
<AppLayout />
</ProtectedRoute>
}
>
<Route index element={<Navigate to="dashboard" />} />
<Route path="dashboard" element={<Dashboard />} />
<Route path="bookings" element={<Bookings />} />
<Route path="bookings/:bookingId" element={<Booking />} />
<Route path="checkin/:bookingId" element={<Checkin />} />
<Route path="cabins" element={<Cabins />} />
<Route path="settings" element={<Settings />} />
<Route path="account" element={<Account />} />
<Route path="users" element={<Users />} />
</Route>
<Route path="login" element={<Login />} />
<Route path="*" element={<PageNotFound />} />
</Routes>
</BrowserRouter>
<Toaster
position="top-right"
containerStyle={{ margin: "8px" }}
gutter={12}
toastOptions={{
success: { duration: 3500 },
error: { duration: 4000 },
style: {
fontSize: "16px",
maxWidth: "500px",
padding: "16px 24px",
backgroundColor: "var(--color-grey-0)",
color: "var(--color-grey-700)",
},
}}
/>
</QueryClientProvider>
</DarkMode>
);
}
export default App;