[Vuejs]-How can I fix an unknown Vuex action type error?

1๐Ÿ‘

โœ…

I have a spell mistake, instead of toggleSidebar I wrote toggleSibebar. After the correction the code work as suposse.

Here is the code:

export const state = () => ({
  toggleSidebar: false,
})

export const mutations = {
  TOGGLE_SIDEBAR(state) {
    state.toggleSidebar = !state.toggleSidebar
  },
}

export const actions = {
  toggleSidebar({ commit }) {
    commit('TOGGLE_SIDEBAR')
  },
}

export const getters = {
  toggleSidebar: (state) => state.toggleSidebar,
}

Implementing ESlint on my project was also the solution.

๐Ÿ‘คAldrin Cuvi

Leave a comment