diff --git a/src/app/modals/profile/profile.page.html b/src/app/modals/profile/profile.page.html
index 0b4d029e5..7b4c9a65b 100644
--- a/src/app/modals/profile/profile.page.html
+++ b/src/app/modals/profile/profile.page.html
@@ -45,7 +45,8 @@
- {{notificationdata.length}} novas notificações
+ {{notificationdata.length}} novas notificações
+ 0 novas notificações
diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts
index d79528541..6a576a779 100644
--- a/src/app/pages/login/login.page.ts
+++ b/src/app/pages/login/login.page.ts
@@ -17,6 +17,7 @@ import { MessageModel, DeleteMessageModel } from '../../models/beast-orm';
import { WsChatService } from 'src/app/services/chat/ws-chat.service';
import { Storage } from '@ionic/storage';
import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service';
+import { ChatService } from 'src/app/services/chat.service';
@Component({
selector: 'app-login',
templateUrl: './login.page.html',
@@ -52,6 +53,7 @@ export class LoginPage implements OnInit {
private WsChatService: WsChatService,
private storage: Storage,
public WsChatMethodsService: WsChatMethodsService,
+ private ChatService: ChatService
) {}
ngOnInit() {
@@ -130,6 +132,7 @@ export class LoginPage implements OnInit {
await this.authService.loginChat(attempt.ChatData.data);
await this.authService.loginToChatWs();
+ this.ChatService.setheader()
}
@@ -156,6 +159,7 @@ export class LoginPage implements OnInit {
if(attempt.ChatData) {
await this.authService.loginChat(attempt.ChatData.data);
await this.authService.loginToChatWs();
+ this.ChatService.setheader()
}
this.getToken();
diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts
index 6d402df58..70978415c 100644
--- a/src/app/services/chat.service.ts
+++ b/src/app/services/chat.service.ts
@@ -360,24 +360,30 @@ export class ChatService {
}
refreshtoken() {
- this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey);
- let options = {
- headers: this.headers
- };
- return this.http.get(environment.apiURL + 'UserAuthentication/RegenereChatToken', options).subscribe(async res => {
- let data = {
- status: res['status'],
- data: {
- userId: res['data'].userId,
- authToken: res['data'].authToken
+
+ if(this.headers) {
+ this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey);
+ let options = {
+ headers: this.headers
+ };
+ return this.http.get(environment.apiURL + 'UserAuthentication/RegenereChatToken', options).subscribe(async res => {
+ let data = {
+ status: res['status'],
+ data: {
+ userId: res['data'].userId,
+ authToken: res['data'].authToken
+ }
}
- }
- SessionStore.user.ChatData = data
- SessionStore.save()
+ SessionStore.user.ChatData = data
+ SessionStore.save()
+ this.setheader()
+ // console.log(res)
+ // console.log(SessionStore.user.ChatData)
+ });
+ } else {
this.setheader()
- // console.log(res)
- // console.log(SessionStore.user.ChatData)
- });
+ }
+
}
}
diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html
index 58b1211e1..483e86441 100644
--- a/src/app/shared/chat/messages/messages.page.html
+++ b/src/app/shared/chat/messages/messages.page.html
@@ -49,7 +49,7 @@
{{msg.u.name}}
{{msg.duration}}
- {{msg._id}}
+