Answer the question
In order to leave comments, you need to log in
Why didn't finilize work on a failed http request?
Method called on click:
public update(): void {
this.loading = true;
this.applicationBuildingsService
.update(this.form.value)
.pipe(
finalize(() => {
this.loading = false;
}),
)
.subscribe(
(response) => {
this.messageService.showMessage('', 'Операция прошла успешно', 'success');
this.dialogRef.close(response);
},
() => {
this.messageService.showMessage('', 'Операция прошла неуспешно', 'error');
},
);
}
update(data: Building): Observable<any> {
let headers = new HttpHeaders();
if (data.ts) {
headers = headers.append('TS', data.ts);
}
return this.http.post(`${this.baseUrl}/update`, data, { headers });
}
finalize(() => {
this.loading = false;
}),
this.loading = false;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question