mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
Handle settings live refresh, unsubscribe subscriptions
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { DOCUMENT } from '@angular/common'
|
||||
import { HttpClient } from '@angular/common/http'
|
||||
import {
|
||||
EventEmitter,
|
||||
Inject,
|
||||
Injectable,
|
||||
LOCALE_ID,
|
||||
@@ -46,6 +47,8 @@ export class SettingsService {
|
||||
|
||||
public displayName: string
|
||||
|
||||
public settingsSaved: EventEmitter<any> = new EventEmitter()
|
||||
|
||||
constructor(
|
||||
rendererFactory: RendererFactory2,
|
||||
@Inject(DOCUMENT) private document,
|
||||
@@ -370,7 +373,13 @@ export class SettingsService {
|
||||
}
|
||||
|
||||
storeSettings(): Observable<any> {
|
||||
return this.http.post(this.baseUrl, { settings: this.settings })
|
||||
return this.http.post(this.baseUrl, { settings: this.settings }).pipe(
|
||||
tap((results) => {
|
||||
if (results.success) {
|
||||
this.settingsSaved.emit()
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
maybeMigrateSettings() {
|
||||
|
Reference in New Issue
Block a user