diff --git a/src/components/theme/App/App.jsx b/src/components/theme/App/App.jsx index 4cb6d4fc6d..4b27d9d0f3 100644 --- a/src/components/theme/App/App.jsx +++ b/src/components/theme/App/App.jsx @@ -8,7 +8,7 @@ import jwtDecode from 'jwt-decode'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { compose } from 'redux'; -import { asyncConnect, Helmet } from '@plone/volto/helpers'; +import { asyncConnect, Helmet, withRouter } from '@plone/volto/helpers'; import { Segment } from 'semantic-ui-react'; import { Outlet } from 'react-router-dom'; import { Slide, ToastContainer, toast } from 'react-toastify'; @@ -273,9 +273,10 @@ export default compose( // }, // ]), injectIntl, + withRouter, connect( (state, props) => ({ - pathname: state.router.location.pathname, + pathname: props.location.pathname, token: state.userSession.token, userId: state.userSession.token ? jwtDecode(state.userSession.token).sub diff --git a/src/components/theme/Login/Login.jsx b/src/components/theme/Login/Login.jsx index f14c6613f8..39c2f3bff7 100644 --- a/src/components/theme/Login/Login.jsx +++ b/src/components/theme/Login/Login.jsx @@ -314,8 +314,8 @@ export default compose( loading: state.userSession.login.loading, token: state.userSession.token, returnUrl: - qs.parse(state.router.location.search).return_url || - state.router.location.pathname + qs.parse(props.location.search).return_url || + props.location.pathname .replace(/\/login$/, '') .replace(/\/logout$/, '') || '/', diff --git a/src/components/theme/Logout/Logout.jsx b/src/components/theme/Logout/Logout.jsx index 8af3637dc1..c4a3d32106 100644 --- a/src/components/theme/Logout/Logout.jsx +++ b/src/components/theme/Logout/Logout.jsx @@ -56,7 +56,7 @@ class Logout extends Component { export default connect( (state, props) => ({ - query: qs.parse(state.router.location.search), + query: qs.parse(props.location.search), }), { logout, purgeMessages }, )(Logout); diff --git a/src/components/theme/View/View.jsx b/src/components/theme/View/View.jsx index 2e736a6a65..a9c242dad1 100644 --- a/src/components/theme/View/View.jsx +++ b/src/components/theme/View/View.jsx @@ -267,8 +267,8 @@ class View extends Component { } export default compose( - withRouter, injectIntl, + withRouter, connect( (state, props) => ({ actions: state.actions.actions, @@ -277,11 +277,10 @@ export default compose( error: state.content.get.error, apiError: state.apierror.error, connectionRefused: state.apierror.connectionRefused, - pathname: state.router.location.pathname, - location: state.router.location, + pathname: props.location.pathname, versionId: - qs.parse(state.router.location.search) && - qs.parse(state.router.location.search).version, + qs.parse(props.location.search) && + qs.parse(props.location.search).version, }), { listActions, diff --git a/src/server.jsx b/src/server.jsx index 94702a82fe..2086135208 100644 --- a/src/server.jsx +++ b/src/server.jsx @@ -134,7 +134,7 @@ function setupServer(req, res, next) { }); // Create a new Redux store instance - const [store] = configureStore(initialState, history, api); + const store = configureStore(initialState, history, api); persistAuthToken(store, req);