michaelolof / vuex-class-component

A Type Safe Vuex Module or Store Using ES6 Classes and ES7 Decorators written in TypeScript.
217 stars 21 forks source link

State undefined with new API in Nuxt #41

Closed danielroe closed 5 years ago

danielroe commented 5 years ago

Implementing the new API, I am running into some strange problems with a virgin Nuxt install.

Accessing $store.state works fine. But getters don't seem to be able to access other class properties. So, for example: $store.getters['userStore/fullname'] returns "undefined undefined".

index.ts:

import { UserStore } from './user'
import { extractVuexModule } from 'vuex-class-component'

export const state = () => ({
  counter: 0,
})

export const modules = {
  ...extractVuexModule(UserStore),
}

user.ts has the content of the example in the README, with typos fixed.

michaelolof commented 5 years ago

Would you mind sharing a sample repo so I can better debug.

Thanks a lot.

danielroe commented 5 years ago

@michaelolof Of course.

https://github.com/danielroe/vuex-class-component-repro

michaelolof commented 5 years ago

Thanks for raising it up this has been fixed in the latest push

https://github.com/michaelolof/vuex-class-component/blob/master/src/proxy.ts#L123