This commit is contained in:
Ahmed Bouhuolia
2020-03-16 00:06:15 +02:00
parent 56701951b7
commit 73711384f6
7925 changed files with 18478 additions and 959 deletions

View File

@@ -1,33 +1,41 @@
import React from 'react';
import PropTypes from 'prop-types';
import {IntlProvider} from 'react-intl';
import {connect} from 'react-redux';
import { IntlProvider } from 'react-intl';
import { connect } from 'react-redux';
import { Router } from 'react-router';
import PrivateRoute from 'components/PrivateRoute';
import Authentication from 'components/Authentication';
import Dashboard from 'components/Dashboard/Dashboard';
// import {isAuthenticated} from 'reducers/authentication'
import { isAuthenticated } from 'store/authentication/authentication.reducer'
import messages from 'lang/en';
import 'style/App.scss';
import { createBrowserHistory } from 'history';
function App(props) {
const history = createBrowserHistory();
return (
<IntlProvider locale={props.locale} messages={messages}>
<div className="App">
<Authentication isAuthenticated={props.isAuthorized} />
<PrivateRoute isAuthenticated={props.isAuthorized} component={Dashboard} />
<Router history={history}>
<Authentication isAuthenticated={props.isAuthorized} />
<PrivateRoute isAuthenticated={props.isAuthorized} component={Dashboard} />
</Router>
</div>
</IntlProvider>
);
}
App.defaultProps = {
locale: 'en',
};
App.propTypes = {
locale: PropTypes.string,
isAuthorized: PropTypes.bool,
};
const mapStateToProps = (state) => ({
isAuthorized: true,
isAuthorized: isAuthenticated(state),
});
export default connect(mapStateToProps)(App);