tap ui settings get to avoid dup

This commit is contained in:
Michael Shamoon 2022-05-17 16:12:59 -07:00
parent 4a7c9a6050
commit 89c5aac9ed
2 changed files with 9 additions and 9 deletions

View File

@ -87,7 +87,6 @@ import localeSr from '@angular/common/locales/sr'
import localeSv from '@angular/common/locales/sv'
import localeTr from '@angular/common/locales/tr'
import localeZh from '@angular/common/locales/zh'
import { Observable } from 'rxjs'
import { SettingsService } from './services/settings.service'
registerLocaleData(localeBe)

View File

@ -10,7 +10,7 @@ import {
} from '@angular/core'
import { Meta } from '@angular/platform-browser'
import { CookieService } from 'ngx-cookie-service'
import { first, Observable } from 'rxjs'
import { first, Observable, tap } from 'rxjs'
import {
BRIGHTNESS,
estimateBrightnessForColor,
@ -60,13 +60,14 @@ export class SettingsService {
// this is called by the app initializer in app.module
public initializeSettings(): Observable<PaperlessUiSettings> {
let settings$ = this.http.get<PaperlessUiSettings>(this.baseUrl)
settings$.pipe(first()).subscribe((uisettings) => {
Object.assign(this.settings, uisettings.settings)
this.maybeMigrateSettings()
this.displayName = uisettings.display_name.trim()
})
return settings$
return this.http.get<PaperlessUiSettings>(this.baseUrl).pipe(
first(),
tap((uisettings) => {
Object.assign(this.settings, uisettings.settings)
this.maybeMigrateSettings()
this.displayName = uisettings.display_name.trim()
})
)
}
public updateAppearanceSettings(