X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/e5198f5d7a60e57a529cf49a96fbb82bc6d8877b..ffcdcd46ef82b5f099feff9bb50d4af39b5acfdb:/src/services/auth-service/auth-service.ts diff --git a/src/services/auth-service/auth-service.ts b/src/services/auth-service/auth-service.ts index 362f7b51..5b975969 100644 --- a/src/services/auth-service/auth-service.ts +++ b/src/services/auth-service/auth-service.ts @@ -22,6 +22,8 @@ export const USER_IS_ACTIVE = 'isActive'; export const USER_USERNAME = 'username'; export const USER_PREFS = 'prefs'; export const HOME_CLUSTER = 'homeCluster'; +export const LOCAL_STORAGE = 'localStorage'; +export const SESSION_STORAGE = 'sessionStorage'; export interface UserDetailsResponse { email: string; @@ -50,6 +52,13 @@ export class AuthService { return localStorage; } + public getStorageType() { + if (this.useSessionStorage) { + return SESSION_STORAGE; + } + return LOCAL_STORAGE; + } + public saveApiToken(token: string) { this.removeApiToken(); this.getStorage().setItem(API_TOKEN_KEY, token);