Feature/improve error handling in http response interceptor (#3471)
* Improve error handling in HttpResponseInterceptor * Update changelog
This commit is contained in:
parent
f5e6f7dcfe
commit
8131a7ad03
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Improved the allocations by ETF holding on the allocations page (experimental)
|
- Improved the allocations by ETF holding on the allocations page (experimental)
|
||||||
|
- Improved the error handling in the `HttpResponseInterceptor`
|
||||||
- Improved the language localization for German (`de`)
|
- Improved the language localization for German (`de`)
|
||||||
- Upgraded `prisma` from version `5.14.0` to `5.15.0`
|
- Upgraded `prisma` from version `5.14.0` to `5.15.0`
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ import { DataService } from '@ghostfolio/client/services/data.service';
|
|||||||
import { TokenStorageService } from '@ghostfolio/client/services/token-storage.service';
|
import { TokenStorageService } from '@ghostfolio/client/services/token-storage.service';
|
||||||
import { WebAuthnService } from '@ghostfolio/client/services/web-authn.service';
|
import { WebAuthnService } from '@ghostfolio/client/services/web-authn.service';
|
||||||
import { InfoItem } from '@ghostfolio/common/interfaces';
|
import { InfoItem } from '@ghostfolio/common/interfaces';
|
||||||
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
HTTP_INTERCEPTORS,
|
HTTP_INTERCEPTORS,
|
||||||
@ -25,7 +24,6 @@ import { catchError, tap } from 'rxjs/operators';
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class HttpResponseInterceptor implements HttpInterceptor {
|
export class HttpResponseInterceptor implements HttpInterceptor {
|
||||||
public hasPermissionForSubscription: boolean;
|
|
||||||
public info: InfoItem;
|
public info: InfoItem;
|
||||||
public snackBarRef: MatSnackBarRef<TextOnlySnackBar>;
|
public snackBarRef: MatSnackBarRef<TextOnlySnackBar>;
|
||||||
|
|
||||||
@ -37,11 +35,6 @@ export class HttpResponseInterceptor implements HttpInterceptor {
|
|||||||
private webAuthnService: WebAuthnService
|
private webAuthnService: WebAuthnService
|
||||||
) {
|
) {
|
||||||
this.info = this.dataService.fetchInfo();
|
this.info = this.dataService.fetchInfo();
|
||||||
|
|
||||||
this.hasPermissionForSubscription = hasPermission(
|
|
||||||
this.info?.globalPermissions,
|
|
||||||
permissions.enableSubscription
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public intercept(
|
public intercept(
|
||||||
@ -65,12 +58,8 @@ export class HttpResponseInterceptor implements HttpInterceptor {
|
|||||||
);
|
);
|
||||||
} else if (!error.url.includes('/auth')) {
|
} else if (!error.url.includes('/auth')) {
|
||||||
this.snackBarRef = this.snackBar.open(
|
this.snackBarRef = this.snackBar.open(
|
||||||
this.hasPermissionForSubscription
|
$localize`This action is not allowed.`,
|
||||||
? $localize`This feature requires a subscription.`
|
undefined,
|
||||||
: $localize`This action is not allowed.`,
|
|
||||||
this.hasPermissionForSubscription
|
|
||||||
? $localize`Upgrade Plan`
|
|
||||||
: undefined,
|
|
||||||
{ duration: 6000 }
|
{ duration: 6000 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user