diff --git a/npm/ng-packs/packages/oauth/src/lib/services/memory-token-storage.service.ts b/npm/ng-packs/packages/oauth/src/lib/services/memory-token-storage.service.ts index 8866d4d0a3..849f118de9 100644 --- a/npm/ng-packs/packages/oauth/src/lib/services/memory-token-storage.service.ts +++ b/npm/ng-packs/packages/oauth/src/lib/services/memory-token-storage.service.ts @@ -11,26 +11,26 @@ export class MemoryTokenStorageService implements OAuthStorage { private localStorageService = inject(AbpLocalStorageService); getItem(key: string): string { - if (!this.keysShouldStoreInMemory.includes(key)) { - return this.localStorageService.getItem(key); + if (this.keysShouldStoreInMemory.includes(key)) { + return this.data.get(key) || null; } - return this.data.get(key) || null; + return this.localStorageService.getItem(key); } removeItem(key: string): void { - if (!this.keysShouldStoreInMemory.includes(key)) { - this.localStorageService.removeItem(key); + if (this.keysShouldStoreInMemory.includes(key)) { + this.data.delete(key); return; } - this.data.delete(key); + this.localStorageService.removeItem(key); } setItem(key: string, data: string): void { - if (!this.keysShouldStoreInMemory.includes(key)) { - this.localStorageService.setItem(key, data); + if (this.keysShouldStoreInMemory.includes(key)) { + this.data.set(key, data); return; } - this.data.set(key, data); + this.localStorageService.setItem(key, data); } clear() {