diff --git a/src/app/_pages/berkas/berkas-list/berkas-list.component.ts b/src/app/_pages/berkas/berkas-list/berkas-list.component.ts index a8985fdff..df802289e 100644 --- a/src/app/_pages/berkas/berkas-list/berkas-list.component.ts +++ b/src/app/_pages/berkas/berkas-list/berkas-list.component.ts @@ -84,7 +84,7 @@ export class BerkasListComponent implements OnInit, OnDestroy { ngOnInit(): void { if (this.gs.isBrowser) { - this.r18 = this.ls.getItem(this.gs.localStorageKeys.R18) === 'true' || false; + this.r18 = this.ls.getItem(this.gs.localStorageKeys.R18) === 'true'; if (!this.gs.isDesktop) { this.tablePageSizeOptions = [10, 25, 50, 75, 100]; } diff --git a/src/app/_shared/components/right-panel/live-chat/live-chat.component.ts b/src/app/_shared/components/right-panel/live-chat/live-chat.component.ts index 8ecf03e2e..9ce566295 100644 --- a/src/app/_shared/components/right-panel/live-chat/live-chat.component.ts +++ b/src/app/_shared/components/right-panel/live-chat/live-chat.component.ts @@ -64,7 +64,12 @@ export class LiveChatComponent implements OnInit, AfterViewInit, OnDestroy { ngOnInit(): void { if (this.gs.isBrowser) { - this.liveChatResult = this.ls.getItem(this.gs.localStorageKeys.LiveChatResults, true) || this.liveChatResult; + const lsObj = this.ls.getItem(this.gs.localStorageKeys.LiveChatResults, true); + if (lsObj) { + for (const [key, value] of Object.entries(lsObj)) { + this.liveChatResult[key] = value; + } + } this.liveChatResult.roomId = this.router.url.split('?')[0]; this.subsCurrentRoom = this.ss.currentRoom.subscribe({ next: current => { diff --git a/src/app/_shared/services/auth.service.ts b/src/app/_shared/services/auth.service.ts index 62ca28b3d..31daf6f07 100644 --- a/src/app/_shared/services/auth.service.ts +++ b/src/app/_shared/services/auth.service.ts @@ -37,7 +37,7 @@ export class AuthService { private toast: ToastService ) { if (this.gs.isBrowser) { - this.token = this.ls.getItem(this.gs.localStorageKeys.Token) || null; + this.token = this.ls.getItem(this.gs.localStorageKeys.Token); this.ls.removeItem(this.gs.localStorageKeys.Token); } } diff --git a/src/app/_shared/services/torrent.service.ts b/src/app/_shared/services/torrent.service.ts index 438452f07..9435a405e 100644 --- a/src/app/_shared/services/torrent.service.ts +++ b/src/app/_shared/services/torrent.service.ts @@ -69,7 +69,12 @@ export class TorrentService { private ls: LocalStorageService ) { if (this.gs.isBrowser) { - this.torrentsQueue = this.ls.getItem(this.gs.localStorageKeys.Torrents, true) || this.torrentsQueue; + const lsObj = this.ls.getItem(this.gs.localStorageKeys.Torrents, true); + if (lsObj) { + for (const [key, value] of Object.entries(lsObj)) { + this.torrentsQueue[key] = value; + } + } if (WebTorrent.WEBRTC_SUPPORT) { this.webClient = new WebTorrent(this.clientOptions); this.gs.log('[TORRENT_CLIENT_WEB_MODE_INITIALIZED]', this.webClient);