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

View file

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

View file

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

View file

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