authelia/client/src/App.tsx

43 lines
1.0 KiB
TypeScript
Raw Normal View History

2018-11-06 23:19:17 +07:00
import React, { Component } from 'react';
import './App.css';
import { Router, Route, Switch } from "react-router-dom";
import { routes } from './routes/index';
import { createBrowserHistory } from 'history';
2019-01-20 02:10:43 +07:00
import { createStore, applyMiddleware, compose } from 'redux';
import reducer from './reducers';
import { Provider } from 'react-redux';
import thunk from 'redux-thunk';
2019-01-20 02:10:43 +07:00
import { routerMiddleware, ConnectedRouter } from 'connected-react-router';
const history = createBrowserHistory();
const store = createStore(
2019-01-20 02:10:43 +07:00
reducer(history),
compose(
applyMiddleware(
routerMiddleware(history),
thunk
)
)
);
2018-11-06 23:19:17 +07:00
class App extends Component {
render() {
return (
<Provider store={store}>
2019-01-20 02:10:43 +07:00
<ConnectedRouter history={history}>
<div className="App">
<Switch>
{routes.map((r, key) => {
return <Route path={r.path} component={r.component} key={key}/>
})}
</Switch>
</div>
2019-01-20 02:10:43 +07:00
</ConnectedRouter>
</Provider>
2018-11-06 23:19:17 +07:00
);
}
}
export default App;