]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/core/theme/theme.service.ts
Redesign account's channels page
[github/Chocobozzz/PeerTube.git] / client / src / app / core / theme / theme.service.ts
index 9dbf22e200147195b35014b752ede3054fa5f2a7..4c4611d01cab765ba0fbcb33050a20a44d021185 100644 (file)
@@ -1,13 +1,13 @@
 import { first } from 'rxjs/operators'
 import { Injectable } from '@angular/core'
+import { UserLocalStorageKeys } from '@root-helpers/users'
+import { ServerConfig, ServerConfigTheme } from '@shared/models'
+import { environment } from '../../../environments/environment'
 import { AuthService } from '../auth'
 import { PluginService } from '../plugins/plugin.service'
 import { ServerService } from '../server'
-import { LocalStorageService } from '../wrappers/storage.service'
-import { User } from '../users/user.model'
 import { UserService } from '../users/user.service'
-import { ServerConfig, ServerConfigTheme } from '@shared/models'
-import { environment } from '../../../environments/environment'
+import { LocalStorageService } from '../wrappers/storage.service'
 
 @Injectable()
 export class ThemeService {
@@ -111,9 +111,9 @@ export class ThemeService {
 
       this.pluginService.reloadLoadedScopes()
 
-      this.localStorageService.setItem(User.KEYS.THEME, JSON.stringify(theme), false)
+      this.localStorageService.setItem(UserLocalStorageKeys.LAST_ACTIVE_THEME, JSON.stringify(theme), false)
     } else {
-      this.localStorageService.removeItem(User.KEYS.THEME, false)
+      this.localStorageService.removeItem(UserLocalStorageKeys.LAST_ACTIVE_THEME, false)
     }
 
     this.oldThemeName = currentTheme
@@ -127,7 +127,7 @@ export class ThemeService {
     if (!this.auth.isLoggedIn()) {
       this.updateCurrentTheme()
 
-      this.localStorageService.watch([User.KEYS.THEME]).subscribe(
+      this.localStorageService.watch([ UserLocalStorageKeys.THEME ]).subscribe(
         () => this.updateCurrentTheme()
       )
     }
@@ -138,7 +138,7 @@ export class ThemeService {
   }
 
   private loadAndSetFromLocalStorage () {
-    const lastActiveThemeString = this.localStorageService.getItem(User.KEYS.THEME)
+    const lastActiveThemeString = this.localStorageService.getItem(UserLocalStorageKeys.LAST_ACTIVE_THEME)
     if (!lastActiveThemeString) return
 
     try {