forked from nathalie/pedi2
Actualizada ruta para saldos
This commit is contained in:
parent
37cdbe5480
commit
0e63e795e4
1 changed files with 3 additions and 2 deletions
5
resources/js/store/modules/comisiones.js
vendored
5
resources/js/store/modules/comisiones.js
vendored
|
@ -17,7 +17,7 @@ const mutations = {
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
async getGruposDeCompra({ commit }) {
|
async getGruposDeCompra({ commit }) {
|
||||||
const response = await axios.get('/api/grupos-de-compra');
|
const response = await axios.get('/api/grupos-de-compra/saldos');
|
||||||
commit('setGruposDeCompra', response.data);
|
commit('setGruposDeCompra', response.data);
|
||||||
},
|
},
|
||||||
async setSaldo({ commit, dispatch }, { gdc_id, saldo }) {
|
async setSaldo({ commit, dispatch }, { gdc_id, saldo }) {
|
||||||
|
@ -29,6 +29,7 @@ const actions = {
|
||||||
commit('setSaldo', { gdc_id: gdc_id, saldo: saldo });
|
commit('setSaldo', { gdc_id: gdc_id, saldo: saldo });
|
||||||
dispatch("ui/toast", { mensaje: 'Saldo modificado con éxito' }, { root: true });
|
dispatch("ui/toast", { mensaje: 'Saldo modificado con éxito' }, { root: true });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
dispatch("ui/error", { error: error }, { root: true });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async cargarSaldos({ commit, dispatch }, formData) {
|
async cargarSaldos({ commit, dispatch }, formData) {
|
||||||
|
@ -48,7 +49,7 @@ const actions = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getters = {
|
const getters = {
|
||||||
getSaldo() {
|
saldo() {
|
||||||
return (gdc_id) => state.grupos_de_compra.find(gdc => gdc.id === gdc_id)?.saldo ?? 0;
|
return (gdc_id) => state.grupos_de_compra.find(gdc => gdc.id === gdc_id)?.saldo ?? 0;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue