-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
31 lines (29 loc) · 1007 Bytes
/
index.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
import ReactDOM from 'react-dom'
import React from 'react'
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'
import { Provider } from 'react-redux'
import store from './store'
import { GuestRoute, AuthRoute } from 'eazy-auth'
import './example.css'
import Home from './components/Home'
import Login from './components/Login'
import About from './components/About'
import Old from './components/Old'
const App = () => (
<Provider store={store}>
<Router basename={process.env.NODE_ENV === 'production' ? '/eazy-auth/' : undefined}>
<Switch>
<GuestRoute path='/login' exact component={Login} />
<AuthRoute path='/' exact component={Home} />
<AuthRoute
path='/old'
exact
component={Old}
redirectTest={user => user.age > 27 ? false : '/'}
/>
<Route path='/about' exact component={About} />
</Switch>
</Router>
</Provider>
)
ReactDOM.render(<App />, document.getElementById('root'))