Skip to content

Commit bfcca95

Browse files
ChamseddineBhdjonenst
authored andcommitted
fix page refresh and back button behaviour
Signed-off-by: ChamseddineBhd <[email protected]>
1 parent 6777e3d commit bfcca95

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/components/app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import StudyManager from './study-manager';
1818
import TopBar from './top-bar';
1919
import {LIGHT_THEME} from '../redux/actions'
2020
import Parameters from "./parameters";
21-
import {userManagerPromise, login, logout, handleSigninCallback} from '../utils/authentication/AuthService';
21+
import {userManagerPromise, login, logout, handleSigninCallback, dispatchUser} from '../utils/authentication/AuthService';
2222
import Authentication from "./authentication";
2323

2424
const lightTheme = createMuiTheme({
@@ -74,6 +74,7 @@ const App = () => {
7474
userManagerPromise
7575
.then(userManager => {
7676
setUserManager({instance : userManager, error : null });
77+
dispatchUser(dispatch, userManager);
7778
})
7879
.catch(function(error) {
7980
setUserManager({instance : null, error : error.message});

src/utils/authentication/AuthService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ function handleSigninCallback(dispatch, history, userManagerInstance) {
5555
userManagerInstance.signinRedirectCallback().then(function () {
5656
dispatchUser(dispatch, userManagerInstance);
5757
const previousPath = sessionStorage.getItem(pathKey);
58-
history.push(previousPath);
58+
history.replace(previousPath);
5959
}).catch(function (e) {
6060
console.error(e);
6161
});
6262
}
6363

64-
export {userManagerPromise, login, logout, handleSigninCallback}
64+
export {userManagerPromise, login, logout, dispatchUser, handleSigninCallback}

0 commit comments

Comments
 (0)