Use OneSginal within router.aftereach
-
Hello.
First of all…congrats for all of this… you guys are amazing =).Ok…
I need to add onesignal to my spa / pwa project.
I have added this https://www.npmjs.com/package/quasar-app-extension-onesignal in a boot file.Now I need to register it on router.aftereach inside index.js.
Router.afterEach((to,from, next) => { to.matched.some( async route =>{ if(route.meta.askForNotification) { // setup one signal app.$oneSignal.setup(process.env.ONESIGNAL_APP_ID) store.watch( () => store.state.auth.user, function (user) { if (user) { // optin using an optional external_user_id app.$oneSignal.optIn(user.push_id) } else { // optout app.$oneSignal.optOut() } } ) } }) })
here is the export default
export default function ({app}) {
but… app is undefined
Can you please guide me how to solve it?
Thanks
-
app extensions you have to install with a command:
https://quasar.dev/app-extensions/introduction#Anatomy-of-App-Extensions
quasar ext add onesignal