get route info from AppContainer
This commit is contained in:
parent
422a98e172
commit
c6c4dead5d
|
@ -1,11 +1,10 @@
|
|||
import {ConnectedRouter} from "connected-react-router";
|
||||
import PropTypes from "prop-types";
|
||||
import {connect} from 'react-redux';
|
||||
import React, {Component} from 'react';
|
||||
import {withRouter} from "react-router-dom";
|
||||
|
||||
import history from '../history';
|
||||
import Layout from '../components/Layout';
|
||||
import routes from '../routes';
|
||||
import queryString from 'query-string';
|
||||
|
||||
import {
|
||||
initBlockHeader,
|
||||
|
@ -17,7 +16,7 @@ import {
|
|||
|
||||
class AppContainer extends Component {
|
||||
componentDidMount() {
|
||||
this.props.authenticate('Test');
|
||||
this.props.authenticate(queryString.parse(this.props.location.search).token);
|
||||
this.props.initBlockHeader();
|
||||
this.props.fetchProcesses();
|
||||
this.props.fetchVersions();
|
||||
|
@ -25,13 +24,7 @@ class AppContainer extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<ConnectedRouter history={history}>
|
||||
<Layout>
|
||||
{routes}
|
||||
</Layout>
|
||||
</ConnectedRouter>
|
||||
);
|
||||
return (<React.Fragment>{routes}</React.Fragment>);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,10 +33,11 @@ AppContainer.propTypes = {
|
|||
initBlockHeader: PropTypes.func,
|
||||
fetchProcesses: PropTypes.func,
|
||||
fetchPlugins: PropTypes.func,
|
||||
fetchVersions: PropTypes.func
|
||||
fetchVersions: PropTypes.func,
|
||||
location: PropTypes.object
|
||||
};
|
||||
|
||||
export default connect(
|
||||
export default withRouter(connect(
|
||||
null,
|
||||
{
|
||||
initBlockHeader,
|
||||
|
@ -52,4 +46,4 @@ export default connect(
|
|||
fetchVersions: versionsAction.request,
|
||||
fetchPlugins: pluginsAction.request
|
||||
},
|
||||
)(AppContainer);
|
||||
)(AppContainer));
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import {ConnectedRouter} from "connected-react-router";
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import {Provider} from 'react-redux';
|
||||
|
@ -5,8 +6,10 @@ import {Provider} from 'react-redux';
|
|||
import "tabler-react/dist/Tabler.css";
|
||||
import "./general.css";
|
||||
import "./slider.css";
|
||||
import Layout from "./components/Layout";
|
||||
|
||||
import AppContainer from './containers/AppContainer';
|
||||
import history from "./history";
|
||||
import registerServiceWorker from './registerServiceWorker';
|
||||
import configureStore from './store/configureStore';
|
||||
|
||||
|
@ -14,7 +17,11 @@ const store = configureStore();
|
|||
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
<AppContainer />
|
||||
<ConnectedRouter history={history}>
|
||||
<Layout>
|
||||
<AppContainer />
|
||||
</Layout>
|
||||
</ConnectedRouter>
|
||||
</Provider>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue