From 2f1e9de6a0de5d89b70a5ea1ba89f20964f2c0a1 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Tue, 3 Sep 2024 13:54:06 +0200 Subject: [PATCH] fix move scopesetup redirect --- frontend/app/Router.tsx | 14 +++++++++----- frontend/app/store.js | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/frontend/app/Router.tsx b/frontend/app/Router.tsx index 8448f824b..57a019118 100644 --- a/frontend/app/Router.tsx +++ b/frontend/app/Router.tsx @@ -170,15 +170,19 @@ const Router: React.FC = (props) => { useEffect(() => { if (prevIsLoggedIn !== isLoggedIn && isLoggedIn) { - handleUserLogin(); - if (scopeSetup) { - history.push(routes.scopeSetup()) - } else if (spotCb) { + void handleUserLogin(); + if (spotCb) { history.push(spotsList()) localStorage.setItem(SPOT_ONBOARDING, 'true') } } - }, [isLoggedIn, scopeSetup]); + }, [isLoggedIn]); + + useEffect(() => { + if (scopeSetup) { + history.push(routes.scopeSetup()) + } + }, [scopeSetup]) useEffect(() => { if (isLoggedIn && location.pathname.includes('login') && localSpotJwt) { diff --git a/frontend/app/store.js b/frontend/app/store.js index 7bfb615d7..371c82a1f 100644 --- a/frontend/app/store.js +++ b/frontend/app/store.js @@ -64,7 +64,7 @@ window.getJWT = () => { } } window.setJWT = (jwt) => { - store.dispatch({ type: UPDATE_JWT, data: jwt }) + store.dispatch({ type: UPDATE_JWT, data: { jwt } }) } export default store;