You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
willaengine/resources/js/Default/store/store/actions.text

66 lines
1.8 KiB

import |-Module-|Repository from "@|-BaseModule-|/abstraction/repositories/|-module-|Repository";
let repository = new |-Module-|Repository();
export default {
async load|-Module-|({ commit, state }) {
try {
commit("SET_LOADING", true);
const |-module-| = await repository.index({pagination: state.pagination, filters: state.filters});
commit("SET_|-MODULE-|", |-module-|.data);
commit("SET_|-MODULE-|_PAGINATION", |-module-|.pagination);
return |-module-|;
} catch (e) {
return e;
} finally {
commit("SET_LOADING", false);
}
},
async show|-Module-|({}, |-module-|Id) {
try {
return await repository.show(|-module-|Id);
} catch (e) {
return e;
}
},
async store|-Module-|({ commit }, data) {
try {
const |-module-| = await repository.store(data);
commit('ADD_|-MODULE-|', |-module-|);
return |-module-|;
} catch (e) {
return e;
}
},
async update|-Module-|({ commit }, data) {
try {
const |-module-| = await repository.update(data);
commit('UPDATE_|-MODULE-|', |-module-|);
return |-module-|;
} catch (e) {
return e;
}
},
async remove|-Module-|({state,commit }, |-module-|Id) {
try {
const response = await repository.destroy(|-module-|Id);
commit("REMOVE_|-MODULE-|", |-module-|Id);
return response;
} catch (e) {
return e;
}
},
async removeMulti|-Module-|({state, commit }, |-module-|Ids) {
try {
const response = await repository.multipleDestroy(|-module-|Ids);
for (const |-module-|Id of |-module-|Ids) {
commit("REMOVE_|-MODULE-|", |-module-|Id);
}
return response;
} catch (e) {
return e;
}
},
};