Vuex-module-decorators: access nuxt context from within action

Created on 27 May 2020  路  2Comments  路  Source: championswimmer/vuex-module-decorators

Hi.

I am trying to access nuxt context from inside an action to be able to access my injected plugins. Kinda similar to how you access the router (this.$router) etc

How would I go about accessing the nuxt context?

Most helpful comment

`
import { Store } from 'vuex'

declare module 'vuex-module-decorators/dist/types' {
interface VuexModule {
store: Store
}
}

`

add this into a shim file. Turns out you can just access your store like that

eg this.store.$router

All 2 comments

Same problem here

`
import { Store } from 'vuex'

declare module 'vuex-module-decorators/dist/types' {
interface VuexModule {
store: Store
}
}

`

add this into a shim file. Turns out you can just access your store like that

eg this.store.$router

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stevefan1999-personal picture stevefan1999-personal  路  5Comments

souphuhn picture souphuhn  路  5Comments

darthf1 picture darthf1  路  5Comments

webcoderkz picture webcoderkz  路  6Comments

Leandro-Albano picture Leandro-Albano  路  3Comments