Feature/protect endpoints (#396)

* Protect endpoints

* Update changelog
This commit is contained in:
Thomas Kaul
2021-09-28 21:37:01 +02:00
committed by GitHub
parent 035052be99
commit fe2bd6eea8
3 changed files with 55 additions and 5 deletions

View File

@@ -61,7 +61,23 @@ export class HttpResponseInterceptor implements HttpInterceptor {
return event;
}),
catchError((error: HttpErrorResponse) => {
if (error.status === StatusCodes.INTERNAL_SERVER_ERROR) {
if (error.status === StatusCodes.FORBIDDEN) {
if (!this.snackBarRef) {
this.snackBarRef = this.snackBar.open(
'This feature requires a subscription.',
'Upgrade Plan',
{ duration: 6000 }
);
this.snackBarRef.afterDismissed().subscribe(() => {
this.snackBarRef = undefined;
});
this.snackBarRef.onAction().subscribe(() => {
this.router.navigate(['/pricing']);
});
}
} else if (error.status === StatusCodes.INTERNAL_SERVER_ERROR) {
if (!this.snackBarRef) {
this.snackBarRef = this.snackBar.open(
'Oops! Something went wrong. Please try again later.',