No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Use OneSginal within router.aftereach

    Help
    2
    2
    104
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • V
      vmco-calif last edited by vmco-calif

      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

      1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel last edited by dobbel

        @vmco-calif

        app extensions you have to install with a command:

        https://quasar.dev/app-extensions/introduction#Anatomy-of-App-Extensions

        quasar ext add onesignal

        1 Reply Last reply Reply Quote 0
        • First post
          Last post