diff --git a/.env b/.env index 4694ca2..bae8a6f 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ VITE_DEBUG_MODE=false -VITE_EFC_API_URL=https://api.efc-aduanasoft.com/api/v1 -VITE_EFC_MICROSERVICE_URL=https://api.efc-aduanasoft.com/microservicio/api/v1 +VITE_EFC_API_URL=http://192.168.1.195:8000/api/v1 +VITE_EFC_MICROSERVICE_URL=http://192.168.1.195:8001/api/v1 diff --git a/src/fetchWithAuth.js b/src/fetchWithAuth.js index 565a2c0..7df82ee 100644 --- a/src/fetchWithAuth.js +++ b/src/fetchWithAuth.js @@ -91,12 +91,10 @@ export const fetchWithAuth = async (url, options = {}) => { let token = localStorage.getItem('access'); // Configurar headers por defecto - let defaultHeaders = {}; - if (token) defaultHeaders['Authorization'] = `Bearer ${token}`; - // Solo poner Content-Type si no es GET o si hay body - if ((options.method && options.method.toUpperCase() !== 'GET') || options.body) { - defaultHeaders['Content-Type'] = 'application/json'; - } + const defaultHeaders = { + 'Content-Type': 'application/json', + ...(token && { 'Authorization': `Bearer ${token}` }) + }; // Combinar headers const finalOptions = {