From 94693ba8cf174c49513c75a37dbe41c3926b9834 Mon Sep 17 00:00:00 2001 From: Cathy Hu Date: Sat, 12 Sep 2020 00:26:29 +0200 Subject: [PATCH] [frontend] Fix unsubscribe error handling --- .../email-unsubscribe.component.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/kibicara-frontend/src/app/platforms/email/email-unsubscribe/email-unsubscribe.component.ts b/kibicara-frontend/src/app/platforms/email/email-unsubscribe/email-unsubscribe.component.ts index ea02a8a..5328b48 100644 --- a/kibicara-frontend/src/app/platforms/email/email-unsubscribe/email-unsubscribe.component.ts +++ b/kibicara-frontend/src/app/platforms/email/email-unsubscribe/email-unsubscribe.component.ts @@ -29,9 +29,16 @@ export class EmailUnsubscribeComponent implements OnInit { this.route.snapshot.queryParams.token, this.route.snapshot.params.id ) - .subscribe(() => { - this.status = 'You were successfully unsubscribed.'; - }); + .subscribe( + () => { + this.status = 'You were successfully unsubscribed.'; + }, + (error) => { + if (error.status === 400) { + this.status = 'Invalid unsubscribe link.'; + } + } + ); } else { this.router.navigate(['/404']); }