Skip to content

Commit

Permalink
fix(admin-ui): Better error message when user lacks permissions
Browse files Browse the repository at this point in the history
Relates to #246
  • Loading branch information
michaelbromley committed Jan 24, 2020
1 parent 0f905b0 commit 1f7c230
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/admin-ui/src/app/data/providers/interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ export class DefaultInterceptor implements HttpInterceptor {
if (firstCode === 'FORBIDDEN') {
this.authService.logOut().subscribe(() => {
if (!window.location.pathname.includes('login')) {
this.displayErrorNotification(_(`error.403-forbidden`));
const path = graqhQLErrors[0].path.join(' > ');
this.displayErrorNotification(_(`error.403-forbidden`), { path });
}
this.router.navigate(['/login'], {
queryParams: {
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/src/i18n-messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
"weekday-we": "We"
},
"error": {
"403-forbidden": "Your session has expired. Please log in",
"403-forbidden": "You are not currently authorized to access \"{ path }\". Either you lack permissions, or your session has expired.",
"could-not-connect-to-server": "Could not connect to the Vendure server at { url }",
"facet-value-form-values-do-not-match": "The number of values in the facet form does not match the actual number of values",
"product-variant-form-values-do-not-match": "The number of variants in the product form does not match the actual number of variants"
Expand Down

0 comments on commit 1f7c230

Please sign in to comment.