fix(fronts): reemplazar IP hardcodeada 192.168.10.123 por /api relativo en TODOS los archivos
Causa raiz: import.meta.env.VITE_API_URL ?? '/api' no activa el fallback cuando VITE_API_URL es string vacio (?? solo cubre null/undefined). Cambiado a || en auth.ts y sistema.ts de todas las apps. Tambien reemplazada la IP hardcodeada en api.ts, mi-dia.ts, reportes.ts y agente-ia.api.ts de todas las apps. Ahora funciona desde IP y dominio sin depender de la red local.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { Mensaje, RespuestaChat } from '../types'
|
||||
|
||||
// Cliente HTTP del API Gateway de FRASA (Express + Prisma)
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? 'http://192.168.10.123:3000/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
||||
// TODO produccion: '/api' same-origin detras de NGINX
|
||||
|
||||
import { conAuth, manejar401 } from './auth'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Sesión de autenticación contra el API Gateway (JWT guardado en localStorage)
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? 'http://192.168.10.123:3000/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||
const STORAGE_KEY = 'frasa_auth'
|
||||
|
||||
export interface UsuarioSesion {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { AltaCliente } from '../types'
|
||||
import { conAuth, manejar401 } from './auth'
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? 'http://192.168.10.123:3000/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
||||
// TODO produccion: '/api' same-origin detras de NGINX
|
||||
|
||||
export interface AltaClienteCreada {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Sesión de autenticación contra el API Gateway (JWT guardado en localStorage)
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||
const STORAGE_KEY = 'frasa_auth'
|
||||
|
||||
export interface UsuarioSesion {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { conAuth, getToken } from './auth'
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? 'http://192.168.10.123:3000/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||
|
||||
export interface EstadoSistema {
|
||||
mondayOk: boolean
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Cliente HTTP del API Gateway de FRASA (Express + Prisma)
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? 'http://192.168.10.123:3000/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
||||
// TODO produccion: '/api' same-origin detras de NGINX
|
||||
|
||||
import { conAuth, manejar401 } from './auth'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Sesión de autenticación contra el API Gateway (JWT guardado en localStorage)
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||
const STORAGE_KEY = 'frasa_auth'
|
||||
|
||||
export interface UsuarioSesion {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { INVENTARIO_SEED } from '../data/unidades'
|
||||
import { conAuth, manejar401 } from './auth'
|
||||
|
||||
// TODO produccion: '/api' same-origin detras de NGINX
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? 'http://192.168.10.123:3000/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
||||
|
||||
export { API_URL }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Sesión de autenticación contra el API Gateway (JWT guardado en localStorage)
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||
const STORAGE_KEY = 'frasa_auth'
|
||||
|
||||
export interface UsuarioSesion {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { conAuth, getToken } from './auth'
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? 'http://192.168.10.123:3000/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||
|
||||
export interface EstadoSistema {
|
||||
mondayOk: boolean
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Sesión de autenticación contra el API Gateway (JWT guardado en localStorage)
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||
const STORAGE_KEY = 'frasa_auth'
|
||||
|
||||
export interface UsuarioSesion {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { conAuth, manejar401 } from './auth'
|
||||
import type { ResumenMiDia } from '../lib/mi-tablero'
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? 'http://192.168.10.123:3000/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
||||
|
||||
/** GET /mi-dia/resumen; lanza Error con mensaje legible si el API falla */
|
||||
export async function fetchResumenMiDia(): Promise<ResumenMiDia> {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { conAuth, manejar401 } from './auth'
|
||||
import type { ResumenReportes } from '../lib/reportes'
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? 'http://192.168.10.123:3000/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
||||
|
||||
/** GET /reportes/resumen; lanza Error con mensaje legible si el API falla */
|
||||
export async function fetchResumen(): Promise<ResumenReportes> {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { conAuth, getToken } from './auth'
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? 'http://192.168.10.123:3000/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||
|
||||
export interface EstadoSistema {
|
||||
mondayOk: boolean
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Sesión de autenticación contra el API Gateway (JWT guardado en localStorage)
|
||||
export const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
||||
export const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||
const STORAGE_KEY = 'frasa_auth'
|
||||
|
||||
export interface UsuarioSesion {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Sesión de autenticación contra el API Gateway (JWT guardado en localStorage)
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||
const STORAGE_KEY = 'frasa_auth'
|
||||
|
||||
export interface UsuarioSesion {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import type { ResumenMiDia } from '../lib/mi-dia'
|
||||
import { conAuth, manejar401 } from './auth'
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? 'http://192.168.10.123:3000/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
||||
|
||||
async function fetchJson<T>(path: string, init: RequestInit = {}): Promise<T> {
|
||||
const res = await fetch(`${API_URL}${path}`, conAuth(init))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Estado del sistema (GET /sistema/estado): salud de Monday y cola de sincronización
|
||||
import { conAuth, getToken } from './auth'
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL ?? 'http://192.168.10.123:3000/api'
|
||||
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||
|
||||
export interface EstadoSistema {
|
||||
mondayOk: boolean
|
||||
|
||||
Reference in New Issue
Block a user