From 17b514303267695fa304544ea1e9d554e1c51be4 Mon Sep 17 00:00:00 2001 From: Kevin Rosales Date: Mon, 4 Aug 2025 22:15:22 -0600 Subject: [PATCH] Se realizaron cambios en el modulo de ventanilla unica --- src/components/Sidebar.jsx | 2 +- src/pages/Vucem.jsx | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/Sidebar.jsx b/src/components/Sidebar.jsx index 87f0f62..e8d9375 100644 --- a/src/components/Sidebar.jsx +++ b/src/components/Sidebar.jsx @@ -163,7 +163,7 @@ export default function Sidebar() { ] ), { - name: 'Vucem', + name: 'Ventanilla Única', path: '/vucem', icon: ( diff --git a/src/pages/Vucem.jsx b/src/pages/Vucem.jsx index c1e90b9..405de95 100644 --- a/src/pages/Vucem.jsx +++ b/src/pages/Vucem.jsx @@ -1,7 +1,6 @@ import React, { useEffect, useState } from 'react'; -const API_URL = 'http://192.168.1.195:8000/api/v1/vucem/vucem/'; - +const API_URL = import.meta.env.VITE_EFC_API_URL; export default function Vucem() { const [vucemList, setVucemList] = useState([]); const [loading, setLoading] = useState(true); @@ -51,7 +50,7 @@ export default function Vucem() { setLoading(true); try { const token = localStorage.getItem('access'); - const res = await fetch(API_URL, { + const res = await fetch(`${API_URL}/vucem/vucem/`, { headers: token ? { 'Authorization': `Bearer ${token}` } : {}, }); if (!res.ok) throw new Error('Error al cargar VUCEM'); @@ -341,7 +340,7 @@ export default function Vucem() { formData.append('is_active', form.is_active); try { const token = localStorage.getItem('access'); - const res = await fetch(API_URL, { + const res = await fetch(`${API_URL}/vucem/vucem/`, { method: 'POST', headers: token ? { 'Authorization': `Bearer ${token}` } : {}, body: formData, @@ -427,7 +426,7 @@ export default function Vucem() { formData.append('is_active', form.is_active); try { const token = localStorage.getItem('access'); - const res = await fetch(`${API_URL}${editVucem.id}/`, { + const res = await fetch(`${API_URL}/vucem/vucem/${editVucem.id}/`, { method: 'PATCH', headers: token ? { 'Authorization': `Bearer ${token}` } : {}, body: formData, @@ -511,7 +510,7 @@ export default function Vucem() { if (!deleteVucem) return; try { const token = localStorage.getItem('access'); - const res = await fetch(`${API_URL}${deleteVucem.id}/`, { + const res = await fetch(`${API_URL}/vucem/vucem/${deleteVucem.id}/`, { method: 'DELETE', headers: token ? { 'Authorization': `Bearer ${token}` } : {}, });