Looking to integrate Google's Firebase Cloud Messaging (FCM) into my Nuxt.js application has led me to successfully install firebase, create a firebase.js plugin in the ./plugins folder, import and initialize firebase along with the messaging service. Everything is functioning smoothly so far.
However, I am now faced with uncertainty on what steps to take next...
The plan is to manage everything within vuex, specifically in the notifications module.
I aim to handle both background and foreground notifications. Background notifications are handled by the service-worker, while for foreground notifications, I have designed a simple notification component that will appear whenever a push notification is received from FCM.
The query at hand:
How should I proceed with registering a service worker, requesting permission, and managing foreground/background notifications? Specifically tailored to Nuxt.js - where exactly should this be implemented? Should I create another plugin solely for this purpose, utilize the middleware folder, or incorporate everything within my default layout file?
What is considered the most efficient approach to tackle this task?
Appreciate any help in advance!