react-logo/frontend/src/app.js

35 lines
1.2 KiB
JavaScript

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'
import HomePage from './pages/home';
import { ConnectedLoginPage as LoginPage } from './pages/login';
import DashBoardClient from './pages/DashBoardClient';
import DashBoardDev from './pages/DashBoardDev';
import { ConnectedLogoutPage as LogoutPage } from './pages/logout';
import { connect } from 'react-redux';
import { history } from './util/history';
export class App extends Component {
render () {
return (
<Fragment>
<HashRouter history={history}>
<Switch>
<Route path='/login' exact component={LoginPage} />
<Route path='/logout' exact component={LogoutPage} />
<Route path='/home' exact component={HomePage} />
<Route path='/dashboard-client' exact component={DashBoardClient} />
<Route path='/dashboard-dev' exact component={DashBoardDev} />
<Route component={() => <Redirect to="/home" />} />
</Switch>
</HashRouter>
</Fragment>
)
}
}
export const ConnectedApp = connect()(App);
export const HotApp = hot(module)(ConnectedApp);