I would like to use Vuex to store state about my client-server communication, e.g. a search logic:
// status is either synching|synched|error
state: { query:"", result:[], status:"synching" }
I implement the search action. Actions can only modify state through mutations:
function search(context, query) {
context.commit("query", query);
context.commit("status", "synching");
// some asynch logic here
...
context.commit("result", result);
context.commit("status", "synched");
...
}
However, now the mutations are exposed to my components as well, they are now able to make my state inconsistent. Is it possible to hide mutations from components?