What is the right way to make API calls with Vuex?
Your action should return a Promise. Your current code just calls Api.post
without returning it, so Vuex is out of the loop. See the example from Vuex docs for Composing Actions.
When you a return a Promise, the action caller can then follow the then()
chain:
this.$store.dispatch('usersCreate').then(() => { // API success}).catch(() => { // API fail});
As for organizing your actions, you don't have to put them all in your store.js
file. Vuex supports modules/namespacing. https://vuex.vuejs.org/en/modules.html