[Vuejs]-Vuex unknown action type: Nuxtjs

3👍

Nuxt automatically transforms store/**/*.js files into Vuex modules, so you don’t need to setup your own store in store/index.js, and it should be removed.

Also, your actions, mutations, and getters currently return a function that returns an object, but that should only be done for state. Instead, they should be objects:

// store/liveEvents/index.js
export const state = () => ({
  eventsList: []
});

export const actions = {
  async eventsList({ commit }) {
    // the actions ...
  },
}

export const mutations = {
  SET_EVENTLIST(state, events) {
    state.eventsList = events;
  },
}

export const getters = {
}
👤tony19

Leave a comment