Fix: login rerouting only works on the user's current tab (PR:#14399)

Signed-off-by: Sasa Jovicic <sjovicic@anexia-it.com>
This commit is contained in:
Sasa Jovicic
2023-10-26 11:21:45 +02:00
committed by Dave
parent f78ba282a6
commit 1ceebb275c

View File

@@ -115,8 +115,11 @@ function SessionProvider({ children }) {
}, [setSessionTimeout, setSessionCountdown]);
useEffect(() => {
const isRedirectCondition = (location, histLength) =>
location.pathname === '/login' && histLength === 2;
const unlisten = history.listen((location, action) => {
if (action === 'POP') {
if (action === 'POP' || isRedirectCondition(location, history.length)) {
setIsRedirectLinkReceived(true);
}
});