diff --git a/src/frontend/app/profile/profile.component.ts b/src/frontend/app/profile/profile.component.ts index ae0f5d42c7f2f59f1284c4c55b3f64d8bcda285a..b3569833c0f9ded3b2295717381e81d627d8334a 100644 --- a/src/frontend/app/profile/profile.component.ts +++ b/src/frontend/app/profile/profile.component.ts @@ -457,11 +457,16 @@ export class ProfileComponent implements OnInit { } toggleSignature(i: number) { - this.http.patch('../rest/users/' + this.authService.user.id + '/signatures/' + this.signaturesService.signaturesList[i].id + '/substituted', { 'substituted': !this.signaturesService.signaturesList[i].substituted }) - .subscribe(() => { + this.http.patch('../rest/users/' + this.authService.user.id + '/signatures/' + this.signaturesService.signaturesList[i].id + '/substituted', { 'substituted': !this.signaturesService.signaturesList[i].substituted }).pipe( + tap(() => { this.signaturesService.signaturesList[i].substituted = !this.signaturesService.signaturesList[i].substituted; this.notificationService.success('lang.modificationSaved'); - }); + }), + catchError((err: any) => { + this.notificationService.handleErrors(err); + return of(false); + }) + ).subscribe(); } getNotifications() {