[Vuejs]-Vuex combining namespaced modules and constants types

1👍

When using namespaces you don’t need to change your mutation and action names. So:

const SET_CATEGORY = 'setCategory' //stays the same

And as you correctly put, to reference this mutation in a module named ‘game:

store.commit(`game/${SET_CATEGORY}`);

or

const moduleName = 'game';
store.commit(`${moduleName}/${SET_CATEGORY}`);

Leave a comment