import { Injectable } from '@angular/core' ; import { LocalStorage } from '@medium-stories/storage' ; import { AuthStorage } from '../interfaces/auth-storage.interface' ; export const authStorageKeys = { accessToken : 'msactn' } ; @ Injectable ( ) export class BaseAuthStorage implements AuthStorage { constructor ( private storage ) { } clear ( ) { for ( const prop of Object . values ( authStorageKeys ) ) { this . storage . removeItem ( prop ) ; } } getAccessToken ( ) { return this . storage . getItem ( authStorageKeys . accessToken ) || null ; } removeAccessToken ( ) { this . storage . removeItem ( authStorageKeys . accessToken ) ; } setAccessToken ( accessToken ) { this . storage . setItem ( authStorageKeys . accessToken , accessToken ) ; } }