From 5534ea728f1d06e10d1c31ccde8fe175f374439e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Fri, 10 Jun 2022 13:44:48 +0100 Subject: [PATCH] Bug on login when chat is down --- src/app/services/chat.service.ts | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts index ca97becee..1db701a39 100644 --- a/src/app/services/chat.service.ts +++ b/src/app/services/chat.service.ts @@ -340,18 +340,22 @@ export class ChatService { } setheader() { - if (this.p.userPermission(this.p.permissionList.Chat.access)) { - this.loggedUserChat = this.authService.ValidatedUserChat; - this.headers = new HttpHeaders(); - + try { if (this.p.userPermission(this.p.permissionList.Chat.access)) { - // - this.headers = this.headers.set('X-User-Id', SessionStore.user.ChatData.data.userId); - this.headers = this.headers.set('X-Auth-Token', SessionStore.user.ChatData.data.authToken); - this.options = { - headers: this.headers, - }; + this.loggedUserChat = this.authService.ValidatedUserChat; + this.headers = new HttpHeaders(); + + if (this.p.userPermission(this.p.permissionList.Chat.access)) { + // + this.headers = this.headers.set('X-User-Id', SessionStore.user.ChatData.data.userId); + this.headers = this.headers.set('X-Auth-Token', SessionStore.user.ChatData.data.authToken); + this.options = { + headers: this.headers, + }; + } } + } catch (error) { + console.log(error) } }