diff --git a/src/app/shared/popover/chat-popover/chat-popover.page.html b/src/app/shared/popover/chat-popover/chat-popover.page.html index f179b830e..d402757a7 100644 --- a/src/app/shared/popover/chat-popover/chat-popover.page.html +++ b/src/app/shared/popover/chat-popover/chat-popover.page.html @@ -1,6 +1,6 @@
-
@@ -8,7 +8,7 @@
- +
diff --git a/src/app/shared/popover/chat-popover/chat-popover.page.ts b/src/app/shared/popover/chat-popover/chat-popover.page.ts index 990d70100..2f0417fa6 100644 --- a/src/app/shared/popover/chat-popover/chat-popover.page.ts +++ b/src/app/shared/popover/chat-popover/chat-popover.page.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { ModalController, NavParams, PopoverController } from '@ionic/angular'; import { ChatService } from 'src/app/services/chat.service'; +import { ToastService } from 'src/app/services/toast.service'; @Component({ selector: 'app-chat-popover', @@ -16,6 +17,7 @@ export class ChatPopoverPage implements OnInit { private modalController: ModalController, private navParams: NavParams, private chatService: ChatService, + private toastService: ToastService, ) { this.roomId = this.navParams.get('roomId'); } @@ -24,14 +26,14 @@ export class ChatPopoverPage implements OnInit { console.log(this.roomId); } - close(){ + close(action:any){ if( window.innerWidth <= 701){ - this.popoverController.dismiss('cancel'); - this.modalController.dismiss('cancel'); + this.popoverController.dismiss(action); + this.modalController.dismiss(action); } else{ - this.popoverController.dismiss('cancel'); - this.modalController.dismiss('cancel'); + this.popoverController.dismiss(action); + this.modalController.dismiss(action); } } @@ -48,16 +50,28 @@ export class ChatPopoverPage implements OnInit { if(this.room.t === 'p'){ this.chatService.leaveGroup(body).subscribe(res=>{ console.log(res); + this.close('leave'); + }, + (error)=>{ + this.toastService.badRequest("Não foi possível sair do grupo") + }, + ()=>{ + //loader.remove() }); } else{ this.chatService.leaveChannel(body).subscribe(res=>{ console.log(res); + this.close('leave'); + }, + (error)=>{ + this.toastService.badRequest("Não foi possível sair do grupo") + }, + ()=>{ + //loader.remove() }); } }); - this.popoverController.dismiss('leave'); - this.modalController.dismiss('leave'); } //Delete