Notificaion from chat added

This commit is contained in:
Eudes Inácio
2023-01-30 15:08:00 +01:00
parent 9fea5d8488
commit 32fb80f1bb
9 changed files with 70 additions and 17 deletions
+26 -2
View File
@@ -1,7 +1,7 @@
/* eslint-disable */
/* tslint:disable */
import { Injectable, NgZone } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { environment } from 'src/environments/environment';
import { StorageService } from 'src/app/services/storage.service';
import { AuthConnstants } from 'src/app/config/auth-constants';
@@ -171,6 +171,28 @@ export class NotificationsService {
);
}
ChatSendMessageNotification(userID,title,bodymsg,roomId) {
const geturl = environment.apiURL + `notifications/send`;
const headers = { 'Authorization': SessionStore.user.BasicAuthKey };
const body = {
UserId: 437,
title: "Teste",
body: "Test",
data: {
Service: "chat",
IdObject: roomId
}
};
let id = 437
this.http.post<Tokenn>(geturl+`?userId=${id}&title=${title}&body=${bodymsg}`, body, { headers }).subscribe(data => {
this.active = true
console.log(data)
}, (error) => {
console.log(error)
})
}
tempClearArray(data) {
this.DataArray = new Array;
}
@@ -222,7 +244,9 @@ export class NotificationsService {
}
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes-pr") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.notification.data.IdObject, 'gabinete-digital']));
}
} else if (notification.notification.data.Service === "chat") {
this.zone.run(() => this.router.navigate(['/home/chat', notification.notification.data.IdObject, 'chat']));
}
}