Static GitHub Issues

[2887] How to import external component with external store

prev: JS execution silently fails on a statically generated site
next: vuex store problem in layout

Hi,

I have a custom node module, and I want to import a vue component from that module to my nuxt project. The external component has its own vuex store and will dispatch its own action. How should I import it to my nuxt project?

For the way I import it now, it will throw [vuex] unknown action type: external_action. I guess it's because this action is not defined in current nuxt project.

The following code is part of the external component, by triggering toggleModalAuth(), it will dispatch action toggleModalAuth, which is defined in the custom module.

methods: {
toggleModalAuth() {
      if(util.jwtTokenIsHere()) {
        this.$store.dispatch('toggleModalIdentity', {
          value: !this.$store.state.modalIdentityIsShown
        })
      } else {
        this.$store.dispatch('toggleModalAuth', {
          value: !this.$store.state.modalAuthIsShown
        })
      }
    }
}

Any help would be appreciated!!

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2509">#c2509</a>)</em></sub></div>