Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
fix(authService): storageChangedReload optional (default: false)
Browse files Browse the repository at this point in the history
  • Loading branch information
doktordirk committed Oct 13, 2016
1 parent 98b6d52 commit 8c5b1cb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/baseConfig.md
Expand Up @@ -123,6 +123,8 @@ platform = 'browser';
storage = 'localStorage'; storage = 'localStorage';
// The key used for storing the authentication response locally // The key used for storing the authentication response locally
storageKey = 'aurelia_authentication'; storageKey = 'aurelia_authentication';
// full page reload if authorization changed in another tab
storageChangedReload = false;
// optional function to extract the expiration date. takes the server response as parameter // optional function to extract the expiration date. takes the server response as parameter
// eg (expires_in in sec): getExpirationDateFromResponse = serverResponse => new Date().getTime() + serverResponse.expires_in * 1000; // eg (expires_in in sec): getExpirationDateFromResponse = serverResponse => new Date().getTime() + serverResponse.expires_in * 1000;
getExpirationDateFromResponse = null; getExpirationDateFromResponse = null;
Expand Down
5 changes: 4 additions & 1 deletion src/authService.js
Expand Up @@ -106,7 +106,10 @@ export class AuthService {
if (this.config.storageChangedRedirect) { if (this.config.storageChangedRedirect) {
PLATFORM.location.href = this.config.storageChangedRedirect; PLATFORM.location.href = this.config.storageChangedRedirect;
} }
PLATFORM.location.reload();
if (this.config.storageChangedReload) {
PLATFORM.location.reload();
}
} }


/** /**
Expand Down
2 changes: 2 additions & 0 deletions src/baseConfig.js
Expand Up @@ -151,6 +151,8 @@ export class BaseConfig {
storage = 'localStorage'; storage = 'localStorage';
// The key used for storing the authentication response locally // The key used for storing the authentication response locally
storageKey = 'aurelia_authentication'; storageKey = 'aurelia_authentication';
// full page reload if authorization changed in another tab
storageChangedReload = false;
// optional function to extract the expiration date. takes the server response as parameter // optional function to extract the expiration date. takes the server response as parameter
// eg (expires_in in sec): getExpirationDateFromResponse = serverResponse => new Date().getTime() + serverResponse.expires_in * 1000; // eg (expires_in in sec): getExpirationDateFromResponse = serverResponse => new Date().getTime() + serverResponse.expires_in * 1000;
getExpirationDateFromResponse = null; getExpirationDateFromResponse = null;
Expand Down

0 comments on commit 8c5b1cb

Please sign in to comment.