Created
October 12, 2017 07:32
-
-
Save afontcu/65118d01ed78c21bb1628c7902641234 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
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