I was wondering why all tutorials say that mutations cannot use async code.
I tried it and it obviously works:
mutations: {
clearTodo(state) { setTimeout(() => state.todo = '', 1000) }
},
results in the same behaviour as:
mutations: {
clearTodo(state) { state.todo = '' }
},
actions: {
clearTodoAction({commit}) { setTimeout(() => commit('clearTodo'), 1000)}
}