Transición a store
This commit is contained in:
parent
83027245e8
commit
3509b9348f
1 changed files with 6 additions and 8 deletions
|
@ -47,6 +47,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
...mapState('barrio',["grupo_de_compra_id","pedidos"]),
|
||||
...mapState('pedido',["nombre","pedido_id"]),
|
||||
deshabilitado: function () {
|
||||
return !this.searchString?.trim()
|
||||
|| this.pedidos.some(p => p.nombre.toLowerCase() === this.searchString.toLowerCase())
|
||||
|
@ -54,6 +55,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
...mapActions('barrio',["getGrupoDeCompra","getPedidos"]),
|
||||
...mapActions('pedido',["crearPedido","getPedido"]),
|
||||
...mapMutations('barrio',["setPedidos"]),
|
||||
onType() {
|
||||
if (!this.searchString) {
|
||||
|
@ -63,17 +65,13 @@ export default {
|
|||
|
||||
this.getPedidos(this.searchString);
|
||||
},
|
||||
submit() {
|
||||
axios.post("/api/subpedidos", {
|
||||
nombre: this.searchString,
|
||||
grupo_de_compra_id: this.grupo_de_compra_id
|
||||
}).then(response => {
|
||||
//se creo el subpedido
|
||||
this.elegirSubpedido(response.data);
|
||||
});
|
||||
async submit() {
|
||||
await this.crearPedido(this.searchString, 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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue