Error when using vuex-module-decorators and @nuxtjs/auth together
See original GitHub issueI am using nuxtjs with typescript and use vuex-module-decorators. but I get error when add @nuxtjs/auth
to my project.
ERR_STORE_NOT_PROVIDED: To use getModule(), either the module should be decorated with store in decorator, i.e. @Module({store: store}) or store should be passed when calling getModule(), i.e. getModule(MyModule, this.$store)
This error happen when call Action.
When @nuxtjs/auth
from modules it’s ok.
store/index.ts
import { Store } from "vuex";
import { initializeStores } from "~/utils/store-accessor";
const initializer = (store: Store<any>) => initializeStores(store);
export const plugins = [initializer];
export * from "~/utils/store-accessor";
utils/store-accessor
import { Store } from "vuex";
import { getModule } from "vuex-module-decorators";
import Login from "~/store/Login";
import App from "~/store/App";
let loginStore: Login, appStore: App;
function initializeStores(store: Store<any>): void {
loginStore = getModule(Login, store);
appStore = getModule(App, store);
}
export { initializeStores, loginStore, appStore };
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:7
Top Results From Across the Web
Error when using vuex-module-decorators and @nuxtjs/auth ...
I am using nuxtjs with typescript and use vuex-module-decorators. but I get error when add @nuxtjs/auth to my project.
Read more >Error when using vuex-module-decorators and @nuxtjs/auth ...
I am using nuxtjs with typescript and use vuex-module-decorators. but I get error when add @nuxtjs/auth to my project.
Read more >Error when using vuex-module-decorators and @nuxtjs/auth ...
Coding example for the question Error when using vuex-module-decorators and @nuxtjs/auth together-Vue.js.
Read more >Error when using vuex-module-decorators and ... - DevPress
Answer a question I am using nuxtjs with typescript and use vuex-module-decorators. but I get error when add @nuxtjs/auth to my project.
Read more >On this page - Nuxt Auth
user. This object contains details about authenticated user such as name. You can access it using either $auth or Vuex.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can try:
@DenisNikonov This works but is lose accessing user info with $auth.