diff --git a/src/routes.js b/src/routes.js index 2dce36b..a6ab351 100644 --- a/src/routes.js +++ b/src/routes.js @@ -26,28 +26,38 @@ import authFlow from 'services/authFlow'; export default function routesFactory(store) { authFlow.setStore(store); - const onEnter = { + const startAuthFlow = { onEnter: ({location}, replace) => authFlow.handleRequest(location.pathname, replace) }; + const userOnly = { + onEnter: ({location}, replace) => { + const {user} = store.getState(); + + if (user.isGuest) { + replace('/'); + } + } + }; + return ( - + - + - - - - - - - - - + + + + + + + + + - +