This commit is contained in:
tiago.kayaya
2021-07-23 14:43:51 +01:00
parent 9bcc06add2
commit b5e1ad4201
17 changed files with 194 additions and 203 deletions
@@ -28,11 +28,10 @@ export class ContactsPage implements OnInit {
private http: HttpClient,
private chatService: ChatService,
private authService: AuthService,
)
{
this.authService.userData$.subscribe((res:any)=>{
this.loggedUser=res;
});
)
{
this.loggedUser = authService.ValidatedUserChat['data'];
this.textSearch="";
this.dm=null;
this.room=null;
@@ -47,7 +46,7 @@ export class ContactsPage implements OnInit {
}
loadUsers(){
this.options = {
this.options = {
headers: this.headers,
};
this.chatService.getAllUsers().subscribe((res:any)=>{
@@ -86,7 +85,7 @@ export class ContactsPage implements OnInit {
close(){
this.modalController.dismiss();
}
clicked(){
console.log('clicked');
}
@@ -99,17 +98,17 @@ export class ContactsPage implements OnInit {
console.log(res);
this.room = res['room'];
console.log(this.room._id);
this.getDirectMessage(this.room._id);
});
}
getDirectMessage(roomId:any){
console.log(roomId);
this.chatService.getAllDirectMessages().subscribe(res=>{
let result = res['ims'].filter(data => data._id == roomId);
console.log(result[0]);
this.dm = result[0];
console.log(this.dm);
this.openModal(this.dm._id);
@@ -118,7 +117,7 @@ export class ContactsPage implements OnInit {
async openModal(roomId:any){
this.close();
console.log(roomId);
const modal = await this.modalController.create({
component: MessagesPage,
cssClass: 'group-messages',
@@ -139,8 +138,8 @@ export class ContactsPage implements OnInit {
//Get direct messages (dm)
/* this.getDirectMessage(this.room._id); */
console.log(this.dm);
/* const modal = await this.modalController.create({
component: MessagesPage,
cssClass: 'group-messages',