vue composition vuex dispatch return promise code example
Example: vuex dispatch is a promise
actions in Vuex are asynchronous. The only way to let the
calling function (initiator of action) to know that an
action is complete - is by returning a Promise and resolving it later.
Here is an example: myAction returns a Promise, makes a http
call and resolves or rejects the Promise later - all asynchronously