react-logo/frontend/src/app.js

35 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-02-04 17:20:39 +01:00
import { Component, Fragment } from 'react'
import { hot } from 'react-hot-loader'
import { HashRouter } from 'react-router-dom' // ou BrowserRouter
import { Route, Switch, Redirect } from 'react-router'
2020-02-17 22:28:57 +01:00
import HomePage from './pages/home';
2020-02-19 12:21:04 +01:00
import { ConnectedLoginPage as LoginPage } from './pages/login';
2020-02-19 11:53:32 +01:00
import DashBoardClient from './pages/DashBoardClient';
import DashBoardDev from './pages/DashBoardDev';
2020-02-19 13:51:14 +01:00
import { ConnectedLogoutPage as LogoutPage } from './pages/logout';
2020-02-25 11:44:05 +01:00
import { connect } from 'react-redux';
import { history } from './util/history';
2020-02-04 17:20:39 +01:00
2020-02-25 11:44:05 +01:00
export class App extends Component {
2020-02-04 17:20:39 +01:00
render () {
return (
<Fragment>
2020-02-25 11:44:05 +01:00
<HashRouter history={history}>
2020-02-04 17:20:39 +01:00
<Switch>
2020-02-19 12:21:04 +01:00
<Route path='/login' exact component={LoginPage} />
2020-02-19 13:51:14 +01:00
<Route path='/logout' exact component={LogoutPage} />
2020-02-17 22:28:57 +01:00
<Route path='/home' exact component={HomePage} />
2020-02-19 11:53:32 +01:00
<Route path='/dashboard-client' exact component={DashBoardClient} />
<Route path='/dashboard-dev' exact component={DashBoardDev} />
2020-02-17 22:28:57 +01:00
<Route component={() => <Redirect to="/home" />} />
2020-02-04 17:20:39 +01:00
</Switch>
</HashRouter>
</Fragment>
)
}
}
2020-02-25 11:44:05 +01:00
export const ConnectedApp = connect()(App);
export const HotApp = hot(module)(ConnectedApp);