-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathApp.js
51 lines (46 loc) · 2.03 KB
/
App.js
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 React from "react";
import { Switch, Route, Redirect } from "react-router-dom";
import { ToastContainer } from "react-toastify";
import NavbarNavGuest from "./components/common/navbarNavGuest";
import Body from "./components/body";
import DebtForm from "./components/debtForm";
import LoginForm from "./components/loginForm";
import forgetPasswordForm from "./components/forgetPasswordForm";
import passwordReset from "./components/passwordReset";
import Logout from "./components/logoutForm";
import RegisterForm from "./components/registerForm";
import NextOfKinForm from "./components/nextOfKinForm";
import Settings from "./components/settings";
import ProtectedRoute from "./components/common/protectedRoute";
import NotFound from "./components/notFound";
import authService from "./services/authService";
import "react-toastify/dist/ReactToastify.css";
import "./styles/App.scss";
function App() {
const username = authService.getCurrentUser() || "Sanwo";
return (
<>
<ToastContainer />
<NavbarNavGuest
username={username}
neglect={["/login", "/forgetpassword", "/register", "/password-reset"]}
/>
<Switch>
<Route path="/register" component={RegisterForm}></Route>
<Route path="/login" component={LoginForm}></Route>
<Route path="/forgetpassword" component={forgetPasswordForm}></Route>
<Route path="/password-reset" component={passwordReset}></Route>
<Route path="/logout" component={Logout}></Route>
<ProtectedRoute path="/debts/:id" component={DebtForm}></ProtectedRoute>
<ProtectedRoute path="/debts/new" component={DebtForm}></ProtectedRoute>
<ProtectedRoute path="/nextofkin" component={NextOfKinForm} />
<ProtectedRoute path="/settings" component={Settings}></ProtectedRoute>
<ProtectedRoute exact path="/" component={Body}></ProtectedRoute>
<Redirect path="/debts" to="/" />
<Route path="/not-found" component={NotFound} />
<Redirect to="not-found" />
</Switch>
</>
);
}
export default App;