becem-gharbi / nuxt-fcm

Firebase Cloud Messaging for Nuxt
MIT License
20 stars 2 forks source link

Duplicated notifications #17

Closed airDjura closed 2 months ago

airDjura commented 2 months ago

I get the same notifications twice whenever I fire an event from BE.

I'm using SSR mode

I managed to make it work by deleting one part of the code from the file: node_modules/@bg-dev/nuxt-fcm/dist/runtime/server/routes/firebase-messaging-sw.get.js

messaging.onBackgroundMessage((payload) => {
      console.log("[firebase-messaging-sw.js] Received background message ", payload);

      self.registration.showNotification(
      payload.notification.title,
      payload.notification);
  });

I have no idea why, but it works normally without that line.

becem-gharbi commented 2 months ago

Apparently, background notifications are automatically shown. Thanks for the issue.

image