Browse Source

fix(admin-ui): Correctly handle missing error codes

Michael Bromley 5 years ago
parent
commit
aa80092573
1 changed files with 1 additions and 1 deletions
  1. 1 1
      packages/admin-ui/src/lib/core/src/data/providers/interceptor.ts

+ 1 - 1
packages/admin-ui/src/lib/core/src/data/providers/interceptor.ts

@@ -82,7 +82,7 @@ export class DefaultInterceptor implements HttpInterceptor {
             // inside the body of the response.
             const graqhQLErrors = response.body.errors;
             if (graqhQLErrors && Array.isArray(graqhQLErrors)) {
-                const firstCode: string = graqhQLErrors[0].extensions.code;
+                const firstCode: string = graqhQLErrors[0]?.extensions?.code;
                 if (firstCode === 'FORBIDDEN') {
                     this.authService.logOut().subscribe(() => {
                         if (!window.location.pathname.includes('login')) {