Răsfoiți Sursa

added second user to second arg

kaori 4 ani în urmă
părinte
comite
9ffcbfc9d5
1 a modificat fișierele cu 8 adăugiri și 6 ștergeri
  1. 8 6
      packages/app/src/server/service/notification.ts

+ 8 - 6
packages/app/src/server/service/notification.ts

@@ -19,12 +19,14 @@ class NortificationService {
   }
 
   updateNotificationevent() {
-    this.notificationEvent.on('update', this.notificationEvent.onUpdate);
-
-    if (this.socketIoService.isInitialized) {
-      // need to pass user in second argument
-      this.socketIoService.getDefaultSocket().emit('notification updated');
-    }
+    this.notificationEvent.on('update', (user) => {
+      this.notificationEvent.onUpdate();
+
+      if (this.socketIoService.isInitialized) {
+        // need to pass user in second argument
+        this.socketIoService.getDefaultSocket().emit('notification updated', { user });
+      }
+    });
   }
 
 }