From 27d4a1c6adf6b81718e929cbd46687d1311d0bcd Mon Sep 17 00:00:00 2001 From: BARDET Brian <brian.bardet9@etu.univ-lorraine.fr> Date: Sat, 19 Jun 2021 16:49:28 +0200 Subject: [PATCH] Correction pb --- ionic/src/app/conversation/conversation.page.ts | 2 +- ionic/src/app/gestion-groupe/gestion-groupe.page.ts | 13 +++++++++---- ionic/src/app/new-groupe/new-groupe.page.ts | 4 +++- ionic/src/app/tab1/tab1.page.ts | 4 +++- ionic/src/app/tab3/tab3.page.ts | 4 ++++ 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ionic/src/app/conversation/conversation.page.ts b/ionic/src/app/conversation/conversation.page.ts index da09c2cec..61b8d126b 100644 --- a/ionic/src/app/conversation/conversation.page.ts +++ b/ionic/src/app/conversation/conversation.page.ts @@ -33,6 +33,7 @@ export class ConversationPage implements OnInit { getMessages(){ this.conversationService.messages(this.id).subscribe(data => { + console.log(data) this.messages = data.reverse(); setTimeout(()=>{this.updateScroll();},200); }); @@ -40,7 +41,6 @@ export class ConversationPage implements OnInit { sendMessage(){ this.conversationService.sendMessage(this.text , this.id).subscribe(data => { - console.log(data); this.text = ""; this.getMessages(); }); diff --git a/ionic/src/app/gestion-groupe/gestion-groupe.page.ts b/ionic/src/app/gestion-groupe/gestion-groupe.page.ts index 63b34d3c3..4a818987d 100644 --- a/ionic/src/app/gestion-groupe/gestion-groupe.page.ts +++ b/ionic/src/app/gestion-groupe/gestion-groupe.page.ts @@ -70,15 +70,20 @@ export class GestionGroupePage implements OnInit { } }) } - if(addUser.length > 0) this.gestionGroupeService.addUser(this.id,addUser).subscribe(data => this.router.navigate(['/conversation/' + this.id])); - if(removeUser.length > 0) this.gestionGroupeService.removeUser(this.id,removeUser).subscribe(data => this.router.navigate(['/conversation/' + this.id])); + if(addUser.length > 0) this.gestionGroupeService.addUser(this.id,addUser).subscribe(data => { }); + if(removeUser.length > 0) this.gestionGroupeService.removeUser(this.id,removeUser).subscribe(data => { }); + + let listeUser = this.usersSelected; + listeUser.push(this.idUser); let body = { "name": name, "description": description, - "users": this.usersSelected + "users": listeUser } - this.gestionGroupeService.updateGroupe(this.id,body).subscribe(data => this.router.navigate(['/conversation/' + this.id])); + this.gestionGroupeService.updateGroupe(this.id,body).subscribe(data => this.router.navigate(['/conversation/' + this.id]).then(() => { + window.location.reload(); + })); } getGroupe(){ diff --git a/ionic/src/app/new-groupe/new-groupe.page.ts b/ionic/src/app/new-groupe/new-groupe.page.ts index 71a615248..070383ad7 100644 --- a/ionic/src/app/new-groupe/new-groupe.page.ts +++ b/ionic/src/app/new-groupe/new-groupe.page.ts @@ -24,7 +24,9 @@ export class NewGroupePage implements OnInit { groupe.subscribe(res => { console.log('groupe crée : ' + JSON.stringify(res)); if(res.name){ - this.router.navigate(['tabs/tab3']); + this.router.navigate(['tabs/tab3']).then(() => { + window.location.reload(); + }); }else{ this.alertGroup(); } diff --git a/ionic/src/app/tab1/tab1.page.ts b/ionic/src/app/tab1/tab1.page.ts index 7aac82034..30b7cefc7 100644 --- a/ionic/src/app/tab1/tab1.page.ts +++ b/ionic/src/app/tab1/tab1.page.ts @@ -18,7 +18,9 @@ export class Tab1Page { disconnect(){ localStorage.removeItem('token'); localStorage.removeItem('user'); - this.router.navigate(['login']); + this.router.navigate(['login']).then(() => { + window.location.reload(); + }); } } diff --git a/ionic/src/app/tab3/tab3.page.ts b/ionic/src/app/tab3/tab3.page.ts index 6ff556f19..e814c6937 100644 --- a/ionic/src/app/tab3/tab3.page.ts +++ b/ionic/src/app/tab3/tab3.page.ts @@ -12,9 +12,13 @@ export class Tab3Page { results; constructor(private tab3Service: Tab3Service) { + } + + ngOnInit() { this.getGroups(); } + getGroups(){ this.tab3Service.getGroups().subscribe(data => { this.results = data; -- GitLab