Skip to content

Commit

Permalink
✔ Fix Local Storage ~
Browse files Browse the repository at this point in the history
  • Loading branch information
bifeldy committed Nov 26, 2023
1 parent 57802c2 commit 4459867
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app/_pages/berkas/berkas-list/berkas-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/_shared/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/app/_shared/services/torrent.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4459867

Please sign in to comment.