client/src/misc/AuthenticatedRoute.js
changeset 168 ea92f4fe783d
parent 129 d48946d164c6
--- a/client/src/misc/AuthenticatedRoute.js	Tue Oct 09 19:07:47 2018 +0200
+++ b/client/src/misc/AuthenticatedRoute.js	Mon Oct 08 18:35:47 2018 +0200
@@ -3,14 +3,14 @@
 import PropTypes from 'prop-types';
 import React from 'react';
 import { Redirect, Route } from 'react-router';
+import { isAuthenticated } from '../selectors/authSelectors';
 
 const AuthenticatedRoute = ({component, ...props}) => {
 
   const { store } = props;
   const state = store.getState();
-  const isAuthenticated = state.getIn(['authStatus', 'isAuthenticated']);
 
-  if (isAuthenticated) {
+  if (isAuthenticated(state)) {
     return <Route { ...props } component={ component } />;
   }