Browse Source

refactoring

pull/24050/head
erdemcaygor 12 months ago
parent
commit
026336eda6
  1. 18
      npm/ng-packs/packages/oauth/src/lib/services/memory-token-storage.service.ts

18
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); private localStorageService = inject(AbpLocalStorageService);
getItem(key: string): string { getItem(key: string): string {
if (!this.keysShouldStoreInMemory.includes(key)) { if (this.keysShouldStoreInMemory.includes(key)) {
return this.localStorageService.getItem(key); return this.data.get(key) || null;
} }
return this.data.get(key) || null; return this.localStorageService.getItem(key);
} }
removeItem(key: string): void { removeItem(key: string): void {
if (!this.keysShouldStoreInMemory.includes(key)) { if (this.keysShouldStoreInMemory.includes(key)) {
this.localStorageService.removeItem(key); this.data.delete(key);
return; return;
} }
this.data.delete(key); this.localStorageService.removeItem(key);
} }
setItem(key: string, data: string): void { setItem(key: string, data: string): void {
if (!this.keysShouldStoreInMemory.includes(key)) { if (this.keysShouldStoreInMemory.includes(key)) {
this.localStorageService.setItem(key, data); this.data.set(key, data);
return; return;
} }
this.data.set(key, data); this.localStorageService.setItem(key, data);
} }
clear() { clear() {

Loading…
Cancel
Save