I'm using @nuxtjs/pwa along with @nuxtjs/onesignal. I'm having an issue with listener to the subscriptionChange event on mounted. It's working very well with localhost, the issue is happened on production.
mounted() {
let self = this;
this.$OneSignal.push(() => {
self.$OneSignal.on('subscriptionChange', (isSubscribed) => {
if (isSubscribed) {
self.$OneSignal.getUserId().then((deviceId) => {
self.addDeviceId(deviceId)
});
}
});
});
}
On production error:

Thank you and appreciate.
Fortunately, I had these issues some hours back you need to access Onesignal using the global window method
window.OneSignal = window.OneSignal || []
window.OneSignal.push(() => {
window.OneSignal.on('subscriptionChange', (isSubscribed) => {
if (isSubscribed) {
window.OneSignal.getUserId().then((deviceId) => {
self.addDeviceId(deviceId)
});
}
});
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With