Просмотр исходного кода

added second user to second arg

kaori 4 лет назад
Родитель
Сommit
9ffcbfc9d5
1 измененных файлов с 8 добавлено и 6 удалено
  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 });
+      }
+    });
   }
 
 }