Created
July 20, 2018 12:36
-
-
Save sanath-kumar/dc3a2a624cb6fb2322e3ecf8132359b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?