Add push notification and device token management.

This commit is contained in:
Ben Goldsworthy 2020-11-30 17:32:56 +00:00
parent 2daf02af2d
commit 7bed14e238
6 changed files with 74 additions and 30 deletions

View file

@ -108,6 +108,14 @@ export class ApiService {
// Push notifications
public checkDeviceToken(data) {
data.session_key = this.sessionKey;
return this.http.post<any>(
this.apiUrl + '/check-device-token',
data
);
}
public addDeviceToken(data) {
data.session_key = this.sessionKey;
return this.http.post<any>(
@ -124,8 +132,15 @@ export class ApiService {
);
}
public getTopics() {
const key = this.sessionKey;
return this.http.post<any>(
this.apiUrl + '/get-topics',
{ session_key : key }
);
}
public sendMessage(data) {
data.devicetoken = localStorage.getItem('devicetoken');
data.sender = localStorage.getItem('displayname');
return this.http.post<any>(
this.apiUrl + '/send-message',