mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Fix create event
This commit is contained in:
@@ -14,7 +14,7 @@ import { ToastService } from '../services/toast.service';
|
||||
import { Optional } from '@angular/core';
|
||||
import { JsonStore } from './jsonStore.service';
|
||||
import { synchro } from './socket/synchro.service';
|
||||
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -27,10 +27,11 @@ export class NotificationsService {
|
||||
callbacks: {
|
||||
type: string,
|
||||
funx: Function
|
||||
id: string
|
||||
}[] = []
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private http: HttpClient,
|
||||
private storageService: StorageService,
|
||||
private modalController: ModalController,
|
||||
public modalCtrl: AlertController,
|
||||
@@ -51,15 +52,28 @@ export class NotificationsService {
|
||||
|
||||
}
|
||||
|
||||
registerCallback(type: string, funx: Function, object: any = {} ) {
|
||||
registerCallback(type: string, funx: Function, object: any = {} ) {
|
||||
|
||||
this.callbacks.push({type, funx})
|
||||
if(!object.hasOwnProperty('desktop') && object['desktop'] != false) {
|
||||
synchro.registerCallback('Notification',funx, type)
|
||||
}
|
||||
|
||||
const id = uuidv4()
|
||||
this.callbacks.push({type, funx, id})
|
||||
if(!object.hasOwnProperty('desktop') && object['desktop'] != false) {
|
||||
synchro.registerCallback('Notification',funx, type)
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
deleteCallback(id) {
|
||||
this.callbacks.forEach((e, index)=>{
|
||||
if(e.id == id) {
|
||||
if (index > -1) {
|
||||
this.callbacks.splice(index, 1);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
getTokenByUserIdAndId(user, userID) {
|
||||
const geturl = environment.apiURL + 'notifications/user/' + userID;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user