[frontend] Fix unsubscribe error handling

This commit is contained in:
Cathy Hu 2020-09-12 00:26:29 +02:00
parent b46c605623
commit 94693ba8cf

View file

@ -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']);
}