-
Notifications
You must be signed in to change notification settings - Fork 13
/
AppRouter.jsx
110 lines (107 loc) · 2.77 KB
/
AppRouter.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import { Basket } from 'components/basket';
import { Footer, Navigation } from 'components/common';
import * as ROUTES from 'constants/routes';
import { createBrowserHistory } from 'history';
import React from 'react';
import { Route, Router, Switch } from 'react-router-dom';
import * as view from 'views';
import AdminRoute from './AdminRoute';
import ClientRoute from './ClientRoute';
import PublicRoute from './PublicRoute';
// Revert back to history v4.10.0 because
// v5.0 breaks navigation
export const history = createBrowserHistory();
const AppRouter = () => (
<Router history={history}>
<>
<Navigation />
<Basket />
<Switch>
<Route
component={view.Search}
exact
path={ROUTES.SEARCH}
/>
<Route
component={view.Home}
exact
path={ROUTES.HOME}
/>
<Route
component={view.Shop}
exact
path={ROUTES.SHOP}
/>
<Route
component={view.FeaturedProducts}
exact
path={ROUTES.FEATURED_PRODUCTS}
/>
<Route
component={view.RecommendedProducts}
exact
path={ROUTES.RECOMMENDED_PRODUCTS}
/>
<PublicRoute
component={view.SignUp}
path={ROUTES.SIGNUP}
/>
<PublicRoute
component={view.SignIn}
exact
path={ROUTES.SIGNIN}
/>
<PublicRoute
component={view.ForgotPassword}
path={ROUTES.FORGOT_PASSWORD}
/>
<Route
component={view.ViewProduct}
path={ROUTES.VIEW_PRODUCT}
/>
<ClientRoute
component={view.UserAccount}
exact
path={ROUTES.ACCOUNT}
/>
<ClientRoute
component={view.EditAccount}
exact
path={ROUTES.ACCOUNT_EDIT}
/>
<ClientRoute
component={view.CheckOutStep1}
path={ROUTES.CHECKOUT_STEP_1}
/>
<ClientRoute
component={view.CheckOutStep2}
path={ROUTES.CHECKOUT_STEP_2}
/>
<ClientRoute
component={view.CheckOutStep3}
path={ROUTES.CHECKOUT_STEP_3}
/>
<AdminRoute
component={view.Dashboard}
exact
path={ROUTES.ADMIN_DASHBOARD}
/>
<AdminRoute
component={view.Products}
path={ROUTES.ADMIN_PRODUCTS}
/>
<AdminRoute
component={view.AddProduct}
path={ROUTES.ADD_PRODUCT}
/>
<AdminRoute
component={view.EditProduct}
path={`${ROUTES.EDIT_PRODUCT}/:id`}
/>
<PublicRoute component={view.PageNotFound} />
</Switch>
<Footer />
</>
</Router>
);
export default AppRouter;