import { Injectable } from '@angular/core' ; import { Observable , of } from 'rxjs' ; @ Injectable ( ) export class TokenStorage { returns { Observable < string > } public getAccessToken ( ) { const token = < string > localStorage . getItem ( 'accessToken' ) ; return of ( token ) ; } returns { Observable < string > } public getRefreshToken ( ) { const token = < string > localStorage . getItem ( 'refreshToken' ) ; return of ( token ) ; } returns { TokenStorage } public setAccessToken ( token ) { localStorage . setItem ( 'accessToken' , token ) ; return this ; } returns { TokenStorage } public setRefreshToken ( token ) { localStorage . setItem ( 'refreshToken' , token ) ; return this ; } /**
    * Remove tokens
    */ public clear ( ) { localStorage . removeItem ( 'accessToken' ) ; localStorage . removeItem ( 'refreshToken' ) ; } }