From c6aca0afff642dbcdd66461de50ed57e1d853fc9 Mon Sep 17 00:00:00 2001 From: Alexandru Munteanu <alexandru.munteanu@thinslices.com> Date: Mon, 19 Feb 2018 16:23:55 +0200 Subject: [PATCH] fix admin route --- .../components-faraday/src/components/Admin/AdminRoute.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/components-faraday/src/components/Admin/AdminRoute.js b/packages/components-faraday/src/components/Admin/AdminRoute.js index 919265c5a..eec048827 100644 --- a/packages/components-faraday/src/components/Admin/AdminRoute.js +++ b/packages/components-faraday/src/components/Admin/AdminRoute.js @@ -15,13 +15,11 @@ const PrivateRoute = ({ <Route {...rest} render={props => { - if (!currentUser.isFetched) { - if (!currentUser.isFetching) { - getCurrentUser() - } - + if (!currentUser.user && !currentUser.isFetching) { + getCurrentUser() return <div>loading…</div> } + if (!get(currentUser, 'user.admin') || !currentUser.isAuthenticated) { return ( <Redirect -- GitLab