VueJS: Cannot read property 'dispatch' of undefined

Viewed 6948

I start my simple project with VueJS and Vuex. And I have a problem witch calling method from store. When I click my button in console I see this error

Uncaught TypeError: Cannot read property 'dispatch' of undefined at VueComponent.onSignin

Here is my component with button which should call dispatch
Login component.

And here is my store index.js Vuex.Store

And here you can find full repo

I read many topics on another forum but I stil don't know why it is not work, because I do similar project few months ago and it works correctly.

1 Answers

Your store should be:

export default new Vuex.Store({

and not

export const store = new Vuex.Store({

Related