From be8430fe5bf502c7294a5482e6e892d592f60cbb Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Fri, 18 Aug 2023 17:45:32 +0530 Subject: [PATCH] fix(ui): jwt redirect --- frontend/app/Router.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/frontend/app/Router.js b/frontend/app/Router.js index 81fcaefc3..3b8e5787c 100644 --- a/frontend/app/Router.js +++ b/frontend/app/Router.js @@ -132,13 +132,9 @@ class Router extends React.Component { }; componentDidMount() { - const { isLoggedIn, location } = this.props; - const destinationPath = localStorage.getItem(GLOBAL_DESTINATION_PATH); - if (!isLoggedIn && !location.pathname.includes('login')) { + const { location } = this.props; + if (!location.pathname.includes('login')) { localStorage.setItem(GLOBAL_DESTINATION_PATH, location.pathname); - } else if (isLoggedIn && destinationPath && !location.pathname.includes(destinationPath)) { - this.props.history.push(destinationPath || '/'); - localStorage.removeItem(GLOBAL_DESTINATION_PATH); } } @@ -162,6 +158,7 @@ class Router extends React.Component { if (!prevProps.isLoggedIn && this.props.isLoggedIn) { this.fetchInitialData(); + localStorage.removeItem(GLOBAL_DESTINATION_PATH); } }