Crear pedido movido a vuex

This commit is contained in:
Alejandro Tasistro 2025-05-21 21:49:04 -03:00
parent 44bd8045b8
commit 5a0cf73218
2 changed files with 3 additions and 4 deletions

View file

@ -55,7 +55,7 @@ export default {
},
methods: {
...mapActions('barrio',["getGrupoDeCompra","getPedidos"]),
...mapActions('pedido',["crearPedido","getPedido"]),
...mapActions('pedido',["crearPedido"]),
...mapMutations('barrio',["setPedidos"]),
onType() {
if (!this.searchString) {
@ -66,12 +66,11 @@ export default {
this.getPedidos(this.searchString);
},
async submit() {
await this.crearPedido(this.searchString, this.grupo_de_compra_id);
await this.crearPedido({ nombre: this.searchString, grupo_de_compra_id: this.grupo_de_compra_id });
this.guardarSubpedidoEnSesion({ id: this.pedido_id, nombre: this.nombre });
},
elegirSubpedido(subpedido) {
//lo guardamos en sesion
this.getPedido(subpedido.id);
this.guardarSubpedidoEnSesion(subpedido);
},
guardarSubpedidoEnSesion(subpedido) {

View file

@ -29,7 +29,7 @@ const mutations = {
};
const actions = {
async crearPedido({ commit }, nombre, grupo_de_compra_id) {
async crearPedido({ commit }, { nombre, grupo_de_compra_id }) {
const response = await axios.post("/api/subpedidos", {
nombre: nombre,
grupo_de_compra_id: grupo_de_compra_id