Agregados mensajes para exito y error al cambiar la cantidad de ollas

This commit is contained in:
Alejandro Tasistro 2025-07-02 00:33:27 -03:00
parent 08bdbe0ee1
commit 929191f173
2 changed files with 11 additions and 5 deletions

View file

@ -15,10 +15,15 @@ const actions = {
const response = await axios.get('/api/parametros');
commit('setMontoPorOlla', response.data);
},
async actualizarCantidadOllas({ rootState }, { cantidad: cantidad}) {
async actualizarCantidadOllas({ rootState, dispatch }, { cantidad: cantidad}) {
try {
const barrio = rootState.pedido.grupo_de_compra.id;
const params = { cantidad : cantidad };
await axios.put(`/ollas/${barrio}/cantidad`, params);
dispatch("ui/toast", { mensaje: 'Cantidad modificada con éxito' }, { root: true });
} catch (error) {
dispatch("ui/error", { error: { message: "Cantidad inválida" } }, { root: true });
}
}
};

View file

@ -61,6 +61,7 @@ const mutations = {
state.devoluciones_notas = null;
},
setCantidadOllas(state, { cantidad }) {
if (cantidad >= 0)
state.cantidad_de_ollas = cantidad;
}
};