From aa800925731dcc0589f0d8d1dc9f7f4c187a8fce Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Wed, 14 Oct 2020 16:13:36 +0200 Subject: [PATCH] fix(admin-ui): Correctly handle missing error codes --- .../admin-ui/src/lib/core/src/data/providers/interceptor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/admin-ui/src/lib/core/src/data/providers/interceptor.ts b/packages/admin-ui/src/lib/core/src/data/providers/interceptor.ts index 6cb5263e7d..4b6c05ac87 100644 --- a/packages/admin-ui/src/lib/core/src/data/providers/interceptor.ts +++ b/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')) {