-
-
-
-
-
-
-
-
-
-
+
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+
);
@@ -51,4 +51,4 @@ function mapDispatchToProps(dispatch) {
};
}
-export default withRouter(connect(mapStateToProps, mapDispatchToProps)(AppContainer));
+export default connect(mapStateToProps, mapDispatchToProps)(AppContainer);
diff --git a/react-app/src/containers/RequireAuthentication.js b/react-app/src/containers/RequireAuthentication.js
index 84fadcb..b8709e6 100644
--- a/react-app/src/containers/RequireAuthentication.js
+++ b/react-app/src/containers/RequireAuthentication.js
@@ -4,33 +4,27 @@
*/
import React from 'react';
-import { Redirect, withRouter } from 'react-router';
-import { connect } from 'react-redux';
+import { Navigate, useLocation } from 'react-router';
+import { useSelector } from 'react-redux';
import { isLoaded } from '../util/loadingObject';
-function mapStateToProps(state) {
- return {
- user: state.auth
- };
-}
-
export default function RequireAuthentication(Component) {
const wrapper = props => {
- if (isLoaded(props.user)) {
+ const location = useLocation();
+ const user = useSelector(state => state.auth);
+ if (isLoaded(user)) {
return