Skip to content

Instantly share code, notes, and snippets.

@sanath-kumar
Created July 20, 2018 12:36
Show Gist options
  • Save sanath-kumar/dc3a2a624cb6fb2322e3ecf8132359b0 to your computer and use it in GitHub Desktop.
Save sanath-kumar/dc3a2a624cb6fb2322e3ecf8132359b0 to your computer and use it in GitHub Desktop.
mutations : {
SET_NAME : (state,name) => {
state.name = name
}
},
actions : {
SET_NAME : async (context, name) => {
let { data } = await Axios.post('http://myapiendpoint.com/api/name',{name : name})
if(data.status == 200){
context.dispatch('SET_NAME', name)
}
}
}
@theunsa
Copy link

theunsa commented Apr 1, 2019

Should line 10 not be: context.commit('SET_NAME', name) for the purpose of your example in https://medium.com/dailyjs/mastering-vuex-zero-to-hero-e0ca1f421d45?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment