fix bugs.

This commit is contained in:
Ahmed Bouhuolia
2020-04-29 05:11:02 +02:00
parent f4520e4e5c
commit f6c5cae82e
42 changed files with 575 additions and 401 deletions

View File

@@ -12,19 +12,24 @@ import Progress from 'components/NProgress/Progress';
import messages from 'lang/en';
import 'style/App.scss';
function App(props) {
function App({
isAuthorized,
locale,
}) {
const history = createBrowserHistory();
history.listen((location, action) => {
console.log(`new location via ${action}`, location);
});
return (
<IntlProvider locale={props.locale} messages={messages}>
<IntlProvider locale={locale} messages={messages}>
<div className="App">
<Router history={history}>
<Authentication isAuthenticated={props.isAuthorized} />
<PrivateRoute isAuthenticated={props.isAuthorized} component={Dashboard} />
<Authentication isAuthenticated={isAuthorized} />
<PrivateRoute isAuthenticated={isAuthorized} component={Dashboard} />
</Router>
</div>
<Progress isAnimating={props.isLoading} />
</IntlProvider>
);
}
@@ -33,13 +38,10 @@ App.defaultProps = {
locale: 'en',
};
App.propTypes = {
locale: PropTypes.string,
isAuthorized: PropTypes.bool,
const mapStateToProps = (state) => {
return {
isAuthorized: isAuthenticated(state),
};
};
const mapStateToProps = (state) => ({
isAuthorized: isAuthenticated(state),
isLoading: !!state.dashboard.requestsLoading,
});
export default connect(mapStateToProps)(App);