Agregada miga para volver al select de pedidos

This commit is contained in:
Alejandro Tasistro 2025-05-26 16:46:39 -03:00
parent 8488d9d6c5
commit 0512ea9ab2
4 changed files with 19 additions and 5 deletions

View file

@ -11,12 +11,13 @@
</template>
<script>
import { mapActions, mapGetters, mapState } from "vuex";
import { mapActions, mapGetters, mapMutations, mapState } from "vuex";
export default {
methods: {
...mapActions('productos',["getProductos"]),
...mapActions('ui',["clickMiga"]),
...mapMutations('ui',["addMiga"]),
},
computed: {
...mapState('ui',["migas"]),
@ -26,8 +27,17 @@ export default {
},
migaActiva() {
return this.migas.length - 1
},
pedido() {
return this.pedidoDefinido
}
},
watch: {
pedido(newValue) {
if (newValue)
this.addMiga({ nombre: 'Categorias', action: 'productos/getProductos' });
}
}
}
</script>

View file

@ -31,6 +31,9 @@ const actions = {
}
});
commit('setPedidos', response.data);
},
async limpiarPedidos({ commit }) {
commit('setPedidos', []);
}
};

View file

@ -85,8 +85,10 @@ const actions = {
dispatch("ui/error", { error: error }, { root: true });
}
},
async resetear({ commit }) {
await axios.delete("/pedido/sesion")
async resetear({ commit, dispatch }) {
await axios.delete("/pedido/sesion");
dispatch("barrio/limpiarPedidos", null, { root: true });
dispatch("productos/getProductos", null, { root: true });
commit('reset');
},
};

View file

@ -3,8 +3,7 @@ import { dropWhile } from "lodash/array";
const state = {
show_chismosa: false,
show_devoluciones: false,
miga_inicial: { nombre: 'Categorias', action: 'productos/getProductos' },
migas: [{ nombre: 'Categorias', action: 'productos/getProductos' }],
migas: [{ nombre: 'Pedidos', action: 'pedido/resetear' }],
};
const mutations = {