-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
77 lines (70 loc) · 2.39 KB
/
App.js
File metadata and controls
77 lines (70 loc) · 2.39 KB
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
import 'react-toastify/dist/ReactToastify.css'
import './assets/scss/webLayout.scss'
import React, { useEffect } from 'react'
import { useClearCache } from 'react-clear-cache'
import { BrowserRouter, Route, Switch, Redirect } from 'react-router-dom'
import User from 'layouts/User'
import Login from 'presentation/Login'
import Register from 'presentation/Register'
import { ToastContainer } from 'react-toastify'
import Loader from 'shared/Loader'
// import Home from 'WebLayout/Home'
// import About from 'WebLayout/About'
// import ProductFeature from 'WebLayout/Product/ProductFeature'
// import Contact from 'WebLayout/Contact'
import ChangePassword from 'presentation/ChangePassword'
import ResetPassword from 'presentation/ResetPassword'
import { loadStateFn } from 'utils/localStorage'
import { useSelector } from 'react-redux'
const App = () => {
const { isLatestVersion, emptyCacheStorage } = useClearCache()
const loginDetail = useSelector((state) => state.auth.loginDetail)
const token = loadStateFn('token')
useEffect(() => {
if (!isLatestVersion) {
emptyCacheStorage()
}
}, [isLatestVersion])
const url = `/reset-password/:any`
return (
<>
<BrowserRouter>
<Loader />
<Switch>
{/* <Route path="/home" exact component={Home} />
<Route path="/about" exact component={About} />
<Route path="/product-features" exact component={ProductFeature} />
<Route path="/contact" exact component={Contact} /> */}
{/* <Route path="/login" component={Login} /> */}
<Route path="/" exact component={Login} />
<Route path={url} component={ResetPassword} />
<Route path="/change-password" component={ChangePassword} />
<Route path="/register" component={Register} />
<Route
path="/"
render={(props) =>
loginDetail.token || token ? (
<User {...props} />
) : (
<Redirect from="/" to="/" />
)
}
/>
<Redirect from="/" to="/admin/index" />
</Switch>
</BrowserRouter>
<ToastContainer
position="top-right"
autoClose={2000}
hideProgressBar={false}
newestOnTop={false}
closeOnClick
rtl={false}
pauseOnFocusLoss
draggable
pauseOnHover
/>
</>
)
}
export default App