From 94e384c83ca1f2c3153f9dd23de4db2711d24786 Mon Sep 17 00:00:00 2001
From: ale <ale.tasistro@gmail.com>
Date: Thu, 22 May 2025 21:46:06 -0300
Subject: [PATCH] Crear pedido setea state, quitado todo lo relativo a sesion,
 y quitado codigo comentado

---
 resources/js/app.js                  | 17 -----------------
 resources/js/store/modules/pedido.js |  9 ---------
 2 files changed, 26 deletions(-)

diff --git a/resources/js/app.js b/resources/js/app.js
index 9b76829..3b3e9cc 100644
--- a/resources/js/app.js
+++ b/resources/js/app.js
@@ -71,21 +71,6 @@ const app = new Vue({
         }
     },
     mounted() {
-        Event.$on('obtener-sesion', () => {
-            if (!window.location.pathname.startsWith('/admin')) {
-                axios.get('/subpedidos/obtener_sesion')
-                    .then(response => {
-                        this.gdc = response.data.gdc;
-                        // this.settearDevoluciones();
-                        this.pedido = response.data.subpedido.id;
-                        axios.get('/api/subpedidos/' + this.pedido)
-                            .then(response => {
-                                this.pedido = response.data.data;
-                                Event.$emit("pedido-actualizado");
-                            });
-                    })
-            }
-        })
       Event.$on('sync-subpedido', (cantidad, id, notas) => {
           if (this.pedido.aprobado) {
             this.$toast('No se puede modificar un pedido ya aprobado', 2000);
@@ -117,8 +102,6 @@ const app = new Vue({
           Event.$emit("pedido-actualizado");
         });
       });
-        if (window.location.pathname.startsWith('/productos'))
-            Event.$emit('obtener-sesion')
     },
 });
 
diff --git a/resources/js/store/modules/pedido.js b/resources/js/store/modules/pedido.js
index aed3e87..215f7e3 100644
--- a/resources/js/store/modules/pedido.js
+++ b/resources/js/store/modules/pedido.js
@@ -34,20 +34,11 @@ const actions = {
             nombre: nombre,
             grupo_de_compra_id: grupo_de_compra_id
         });
-        const pedido = response.data;
-        await axios.post("/subpedidos/sesion", { id: pedido.id, });
-        commit('setState', pedido);
-    },
-    async getPedido({ commit }) {
-        const sesion = await axios.get("/subpedidos/sesion");
-        const response = await axios.get(`/api/subpedidos/${sesion.data}`);
         commit('setState', response.data.data);
     },
     async elegirPedido({ commit }, { pedido }) {
-        await axios.post("/subpedidos/sesion", { id: pedido.id, });
         const response = await axios.get(`/api/subpedidos/${pedido.id}`);
         commit('setState', response.data.data);
-        // window.location.href = 'productos';
     },
     async modificarChismosa({ commit }, producto_id, cantidad, notas) {},
     async modificarDevoluciones({ commit }, monto, notas) {}