JsonStore added and Service created

This commit is contained in:
Eudes Inácio
2021-07-29 16:02:39 +01:00
parent 32017af732
commit 8870d2de05
6 changed files with 150 additions and 7 deletions
+7 -1
View File
@@ -12,6 +12,7 @@ import { ModalController, AlertController, AnimationController, Platform } from
import { NavigationExtras,Router } from '@angular/router';
import { ToastService } from '../services/toast.service';
import { Optional } from '@angular/core';
import { JsonStore } from './jsonStore.service';
@Injectable({
providedIn: 'root'
@@ -31,7 +32,8 @@ export class NotificationsService {
private router: Router,
private toastService: ToastService,
private zone: NgZone,
private activeroute: ActivatedRoute) { }
private activeroute: ActivatedRoute,
private jsonstore: JsonStore) { }
getTokenByUserIdAndId(user, userID) {
const geturl = environment.apiURL + 'notifications/user/' + userID;
@@ -40,6 +42,7 @@ export class NotificationsService {
}
getAndpostToken(username) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
console.log('Notifications not supported')
} else {
@@ -109,6 +112,9 @@ export class NotificationsService {
}
);
var notificationReceived = (message) => {
this.jsonstore.createCollection('Notifications',message);
this.jsonstore.getCollection('Notifications')
console.log("Notification Store: ", this.jsonstore.getCollection('Notifications')[0]);
console.log(message);
var data = JSON.parse(message.payload);
console.log(data.Service);