Skip to content

Instantly share code, notes, and snippets.

@afontcu
Created October 12, 2017 07:32
Show Gist options
  • Save afontcu/65118d01ed78c21bb1628c7902641234 to your computer and use it in GitHub Desktop.
Save afontcu/65118d01ed78c21bb1628c7902641234 to your computer and use it in GitHub Desktop.
const store = new Vuex.Store({
state: {
count: 0
},
mutations: {
update (state, value) {
state.count = value
}
},
actions: {
update ({ commit }, value) {
axios
.get('/count', value)
.then(({ data }) => {
commit('update', data.value)
})
},
reset ({ commit }) {
commit('update', 0)
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment