[Vuejs]-Separating store into separate files (actions, mutations, getters) get api calls now not working

1👍

It looks like you are importing actions from ./actions. However, when I look at your file at store/actions.js you are not exporting anything.

For JavaScript modules to work you have to add export statements to your files – so you can import the exported variables/properties somewhere else.

Also: You seem to only declare the function getMovies() without adding it to an actions object (which you import in store.js).

Try this:

// in store/actions.js

// your code..

const actions = {
  getMovies,
}

export default actions;

Edit:

Just noticed you also use this in your action. If I am not mistaken it should be undefined as you only work with lambdas (Arrow Functions).

👤MarcRo

Leave a comment