Browse Source

fix(admin-ui): Better error message when user lacks permissions

Relates to #246
Michael Bromley 6 years ago
parent
commit
1f7c230e2a

+ 2 - 1
packages/admin-ui/src/app/data/providers/interceptor.ts

@@ -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: {

+ 1 - 1
packages/admin-ui/src/i18n-messages/en.json

@@ -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"