diff --git a/resources/js/app.js b/resources/js/app.js index fd19e5b..aadb9e8 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -82,9 +82,14 @@ const app = new Vue({ }, mounted() { Event.$on('obtener-sesion', () => { - axios.get('/subpedidos/obtener_sesion') - .then(response => { - if (response.data.subpedido.id) { + if (window.location.pathname.startsWith('/admin')) { + axios.get('/admin/obtener_sesion') + .then(response => { + this.gdc = response.data.gdc + }); + } else { + axios.get('/subpedidos/obtener_sesion') + .then(response => { this.gdc = response.data.gdc; this.settearDevoluciones(); this.pedido = response.data.subpedido.id; @@ -93,13 +98,8 @@ const app = new Vue({ this.pedido = response.data.data; Event.$emit("pedido-actualizado"); }); - } else { - axios.get('/admin/obtener_sesion') - .then(response => { - this.gdc = response.data.gdc - }); - } - }) + }) + } }) Event.$on('sync-subpedido', (cantidad, id, notas) => { if (this.pedido.aprobado) {