This commit is contained in:
Eugene Pankov
2021-06-15 23:43:23 +02:00
parent e1425c6c80
commit 15d1fe4a46
17 changed files with 276 additions and 1031 deletions

View File

@@ -9,8 +9,9 @@ export class AppConnectorService {
private configUpdate = new Subject<string>()
constructor (private http: HttpClient) {
this.configUpdate.pipe(debounceTime(1000)).subscribe(content => {
this.http.patch(`/api/1/configs/${this.config.id}`, { content }).toPromise()
this.configUpdate.pipe(debounceTime(1000)).subscribe(async content => {
const result = await this.http.patch(`/api/1/configs/${this.config.id}`, { content }).toPromise()
Object.assign(this.config, result)
})
}
@@ -20,5 +21,6 @@ export class AppConnectorService {
async saveConfig (content: string): Promise<void> {
this.configUpdate.next(content)
this.config.content = content
}
}