Skip to content

Commit

Permalink
fix page refresh and back button behaviour
Browse files Browse the repository at this point in the history
Signed-off-by: ChamseddineBhd <chamseddine.benhamed@ensi-uma.tn>
  • Loading branch information
ChamseddineBhd authored and jonenst committed Apr 3, 2020
1 parent 6777e3d commit bfcca95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/components/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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});
Expand Down
4 changes: 2 additions & 2 deletions src/utils/authentication/AuthService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}

0 comments on commit bfcca95

Please sign in to comment.