This commit is contained in:
Peter Maquiran
2022-07-22 15:52:10 +01:00
parent 5533116e9d
commit 3a6b23b5f5
4 changed files with 29 additions and 18 deletions
+2 -1
View File
@@ -45,7 +45,8 @@
</ion-buttons>
</div>
<div class="line"></div>
<ion-label (click)="asyncNotification()">{{notificationdata.length}} novas notificações</ion-label>
<ion-label (click)="asyncNotification()" *ngIf="notificationdata">{{notificationdata.length}} novas notificações</ion-label>
<ion-label (click)="asyncNotification()" *ngIf="!notificationdata">0 novas notificações</ion-label>
</div>
</ion-header>
+4
View File
@@ -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();
+22 -16
View File
@@ -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)
});
}
}
}
@@ -49,7 +49,7 @@
<div class="title">
<ion-label>{{msg.u.name}}</ion-label>
<span class="time">{{msg.duration}}</span>
{{msg._id}}
<!-- {{msg._id}} -->
</div>
<div class="d-flex justify-space-between">