Refresh token done

This commit is contained in:
Eudes Inácio
2022-06-10 09:42:41 +01:00
parent 1bdf3daf12
commit 4275d71a43
16 changed files with 19 additions and 93 deletions
@@ -48,7 +48,7 @@ export class ChatOptionsFeaturesPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.chatService.refreshtoken();
} }
notImplemented() { notImplemented() {
@@ -118,12 +118,6 @@ export class ChatOptionsFeaturesPage implements OnInit {
this.chatService.sendMessage(body).subscribe(res=> { this.chatService.sendMessage(body).subscribe(res=> {
// //
},(error: HttpErrorResponse) => {
if(error.status === 401){
this.chatService.refreshtoken()
this.chatService.sendMessage(body);
}
}); });
// //
}; };
@@ -149,12 +143,6 @@ export class ChatOptionsFeaturesPage implements OnInit {
this.chatService.sendMessage(body).subscribe(res=> { this.chatService.sendMessage(body).subscribe(res=> {
},(error: HttpErrorResponse) => {
if(error.status === 401){
this.chatService.refreshtoken()
this.chatService.sendMessage(body);
}
}); });
} }
@@ -33,7 +33,7 @@ export class SetRoomOwnerPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.chatService.refreshtoken();
} }
async close(){ async close(){
+2 -6
View File
@@ -142,6 +142,8 @@ export class ChatPage implements OnInit {
} }
SessionStore.user.ChatData = data SessionStore.user.ChatData = data
SessionStore.save() */ SessionStore.save() */
console.log(SessionStore.user.ChatData.data.authToken)
this.chatService.refreshtoken();
this.segment = "Contactos"; this.segment = "Contactos";
@@ -517,12 +519,6 @@ export class ChatPage implements OnInit {
// //
}*/ }*/
},(error: HttpErrorResponse) => {
if(error.status === 401){
this.chatService.refreshtoken()
//this.getChatMembers();
}
}); });
} }
@@ -29,6 +29,7 @@ export class EditGroupPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.chatService.refreshtoken();
this.getRoomInfo(); this.getRoomInfo();
} }
@@ -37,11 +38,6 @@ export class EditGroupPage implements OnInit {
this.room = room['room']; this.room = room['room'];
this.groupName = this.room.name.split('-').join(' '); this.groupName = this.room.name.split('-').join(' ');
},(error: HttpErrorResponse) => {
if(error.status === 401) {
this.chatService.refreshtoken();
this.getRoomInfo()
}
}); });
} }
@@ -56,6 +56,7 @@ export class GroupContactsPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.chatService.refreshtoken();
this.loadUsers(); this.loadUsers();
this.getMembers(); this.getMembers();
@@ -85,12 +86,6 @@ export class GroupContactsPage implements OnInit {
this.showLoader = false; this.showLoader = false;
},(error: HttpErrorResponse) => {
if(error.status === 401){
this.chatService.refreshtoken()
this.loadUsers();
}
}); });
} }
@@ -133,6 +133,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
} }
ngOnInit() { ngOnInit() {
this.chatService.refreshtoken();
this.loggedUser = this.loggedUserChat; this.loggedUser = this.loggedUserChat;
this.getRoomInfo(); this.getRoomInfo();
@@ -381,12 +382,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.allUsers = res['users'].filter(data => data.username != SessionStore.user.UserName); this.allUsers = res['users'].filter(data => data.username != SessionStore.user.UserName);
},(error: HttpErrorResponse) => {
if(error.status === 401){
this.chatService.refreshtoken()
this.getChatMembers();
}
}); });
} }
@@ -43,6 +43,7 @@ export class ContactsPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.chatService.refreshtoken();
this.loadUsers(); this.loadUsers();
} }
@@ -67,12 +68,6 @@ export class ContactsPage implements OnInit {
return 0; return 0;
}); });
this.showLoader = false; this.showLoader = false;
},(error: HttpErrorResponse) => {
if(error.status === 401){
this.chatService.refreshtoken()
this.loadUsers();
}
}); });
} }
+1 -6
View File
@@ -157,6 +157,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
} }
ngOnInit() { ngOnInit() {
this.chatService.refreshtoken();
this.wsChatMethodsService.getUserOfRoom(this.roomId).then((value) => { this.wsChatMethodsService.getUserOfRoom(this.roomId).then((value) => {
}) })
@@ -520,12 +521,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.members = res['members']; this.members = res['members'];
this.dmUsers = res['members'].filter(data => data.username != this.sessionStore.user.UserName) this.dmUsers = res['members'].filter(data => data.username != this.sessionStore.user.UserName)
this.showLoader = false; this.showLoader = false;
},(error: HttpErrorResponse) => {
if(error.status === 401){
this.chatService.refreshtoken()
this.getChatMembers();
}
}); });
} }
@@ -43,6 +43,7 @@ export class NewGroupPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.chatService.refreshtoken();
console.log(this.documents) console.log(this.documents)
} }
@@ -34,6 +34,7 @@ export class EditGroupPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.chatService.refreshtoken();
this.getRoomInfo(); this.getRoomInfo();
} }
@@ -42,12 +43,6 @@ export class EditGroupPage implements OnInit {
this.room = room['room']; this.room = room['room'];
this.groupName = this.room.name.split('-').join(' '); this.groupName = this.room.name.split('-').join(' ');
},(error: HttpErrorResponse) => {
if(error.status === 401){
this.chatService.refreshtoken()
this.getRoomInfo();
}
}); });
} }
@@ -57,6 +57,7 @@ export class GroupContactsPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.chatService.refreshtoken();
//this.getRoomInfo(); //this.getRoomInfo();
this.loadUsers(); this.loadUsers();
@@ -203,12 +204,6 @@ export class GroupContactsPage implements OnInit {
this.showLoader = false; this.showLoader = false;
},(error: HttpErrorResponse) => {
if(error.status === 401){
this.chatService.refreshtoken()
this.loadUsers();
}
}); });
} }
@@ -160,6 +160,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
} }
ngOnInit() { ngOnInit() {
this.chatService.refreshtoken();
console.log(this.roomId) console.log(this.roomId)
this.loggedUser = this.loggedUserChat; this.loggedUser = this.loggedUserChat;
//setTimeout(() => { //setTimeout(() => {
@@ -367,12 +368,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
this.allUsers = res['users'].filter(data => data.username != SessionStore.user.UserName); this.allUsers = res['users'].filter(data => data.username != SessionStore.user.UserName);
// //
},(error: HttpErrorResponse) => {
if(error.status === 401){
this.chatService.refreshtoken()
this.getChatMembers();
}
}); });
} }
@@ -42,7 +42,9 @@ export class ContactsPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.loadUsers(); this.loadUsers();
this.chatService.refreshtoken();
} }
onChange(event){ onChange(event){
@@ -83,12 +85,6 @@ export class ContactsPage implements OnInit {
return 0; return 0;
}); });
this.showLoader = false; this.showLoader = false;
},(error: HttpErrorResponse) => {
if(error.status === 401){
this.chatService.refreshtoken()
this.loadUsers();
}
}); });
} }
@@ -155,6 +155,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
} }
ngOnInit() { ngOnInit() {
this.chatService.refreshtoken();
this.scrollToBottom(); this.scrollToBottom();
this.getChatMembers(); this.getChatMembers();
@@ -525,12 +526,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.members = res['members']; this.members = res['members'];
this.dmUsers = res['members'].filter(data => data.username != this.sessionStore.user.UserName) this.dmUsers = res['members'].filter(data => data.username != this.sessionStore.user.UserName)
this.showLoader = false; this.showLoader = false;
},(error: HttpErrorResponse) => {
if(error.status === 401){
this.chatService.refreshtoken()
this.getChatMembers();
}
}); });
} }
@@ -32,7 +32,7 @@ export class ChatPopoverPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.chatService.refreshtoken();
} }
close(action:any){ close(action:any){
@@ -169,12 +169,6 @@ export class ChatPopoverPage implements OnInit {
}); });
} }
},(error: HttpErrorResponse) => {
if(error.status === 401){
this.chatService.refreshtoken()
this.deleteGroup();
}
}); });
this.popoverController.dismiss('delete'); this.popoverController.dismiss('delete');
this.modalController.dismiss('delete'); this.modalController.dismiss('delete');
@@ -25,6 +25,7 @@ export class MessagesOptionsPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.chatService.refreshtoken();
} }
close(){ close(){
@@ -42,12 +43,6 @@ export class MessagesOptionsPage implements OnInit {
let body = { "roomId": this.roomId } let body = { "roomId": this.roomId }
this.chatService.removeChatRoom(body).subscribe(res=>{ this.chatService.removeChatRoom(body).subscribe(res=>{
},(error: HttpErrorResponse) => {
if(error.status === 401){
this.chatService.refreshtoken()
this.closeChatRoom();
}
}); });
this.close(); this.close();
} }