From bfcca958c1309709e2f1c49fd364dc95a4c62e5a Mon Sep 17 00:00:00 2001 From: ChamseddineBhd Date: Fri, 3 Apr 2020 17:06:45 +0200 Subject: [PATCH] fix page refresh and back button behaviour Signed-off-by: ChamseddineBhd --- src/components/app.js | 3 ++- src/utils/authentication/AuthService.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/app.js b/src/components/app.js index 983d1436bd..1a9fa733e3 100644 --- a/src/components/app.js +++ b/src/components/app.js @@ -18,7 +18,7 @@ import StudyManager from './study-manager'; import TopBar from './top-bar'; import {LIGHT_THEME} from '../redux/actions' import Parameters from "./parameters"; -import {userManagerPromise, login, logout, handleSigninCallback} from '../utils/authentication/AuthService'; +import {userManagerPromise, login, logout, handleSigninCallback, dispatchUser} from '../utils/authentication/AuthService'; import Authentication from "./authentication"; const lightTheme = createMuiTheme({ @@ -74,6 +74,7 @@ const App = () => { userManagerPromise .then(userManager => { setUserManager({instance : userManager, error : null }); + dispatchUser(dispatch, userManager); }) .catch(function(error) { setUserManager({instance : null, error : error.message}); diff --git a/src/utils/authentication/AuthService.js b/src/utils/authentication/AuthService.js index c0b8dcea70..9af0f4b9bc 100644 --- a/src/utils/authentication/AuthService.js +++ b/src/utils/authentication/AuthService.js @@ -55,10 +55,10 @@ function handleSigninCallback(dispatch, history, userManagerInstance) { userManagerInstance.signinRedirectCallback().then(function () { dispatchUser(dispatch, userManagerInstance); const previousPath = sessionStorage.getItem(pathKey); - history.push(previousPath); + history.replace(previousPath); }).catch(function (e) { console.error(e); }); } -export {userManagerPromise, login, logout, handleSigninCallback} +export {userManagerPromise, login, logout, dispatchUser, handleSigninCallback}