xlcs/xlcs-user/store/modules/categories.js
2024-01-07 01:10:08 +08:00

28 lines
597 B
JavaScript

const state = {
categories: []
};
const getters = {};
const mutations = {
updateCategoriesMutation(state, payload) {
state.categories = payload;
}
};
const actions = {
async getCategoriesAction({
commit
}) {
return new Promise(async reslove => {
let result = await this._vm.$u.api.getCategories()
commit('updateCategoriesMutation', result)
reslove();
})
}
};
export default {
namespaced: true,
state,
mutations,
actions,
getters,
};