fix(api-url): todas las apps usan || en vez de ?? para VITE_API_URL
- 11 archivos corregidos: agente-ia, alta-clientes, cobranza, cotizador, dashboards, mi-dia, landing (auth.ts, api.ts, mi-dia.ts, reportes.ts, push.ts, notas.ts, recordatorios.ts, reporte-mi-tablero.ts) - ?? solo cubre null/undefined, || cubre string vacío - 7 apps reconstruidas
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import type { Mensaje, RespuestaChat } from '../types'
|
import type { Mensaje, RespuestaChat } from '../types'
|
||||||
|
|
||||||
// Cliente HTTP del API Gateway de FRASA (Express + Prisma)
|
// Cliente HTTP del API Gateway de FRASA (Express + Prisma)
|
||||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||||
// TODO produccion: '/api' same-origin detras de NGINX
|
// TODO produccion: '/api' same-origin detras de NGINX
|
||||||
|
|
||||||
import { conAuth, manejar401 } from './auth'
|
import { conAuth, manejar401 } from './auth'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { AltaCliente } from '../types'
|
import type { AltaCliente } from '../types'
|
||||||
import { conAuth, manejar401 } from './auth'
|
import { conAuth, manejar401 } from './auth'
|
||||||
|
|
||||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||||
// TODO produccion: '/api' same-origin detras de NGINX
|
// TODO produccion: '/api' same-origin detras de NGINX
|
||||||
|
|
||||||
export interface AltaClienteCreada {
|
export interface AltaClienteCreada {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// Cliente HTTP del API Gateway de FRASA (Express + Prisma)
|
// Cliente HTTP del API Gateway de FRASA (Express + Prisma)
|
||||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||||
// TODO produccion: '/api' same-origin detras de NGINX
|
// TODO produccion: '/api' same-origin detras de NGINX
|
||||||
|
|
||||||
import { conAuth, manejar401 } from './auth'
|
import { conAuth, manejar401 } from './auth'
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { conAuth, manejar401 } from './auth'
|
|||||||
import { guardarUnidades, cargarUnidadesLocal } from './offline-db'
|
import { guardarUnidades, cargarUnidadesLocal } from './offline-db'
|
||||||
|
|
||||||
// TODO produccion: '/api' same-origin detras de NGINX
|
// TODO produccion: '/api' same-origin detras de NGINX
|
||||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||||
|
|
||||||
export { API_URL }
|
export { API_URL }
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { conAuth, manejar401 } from './auth'
|
import { conAuth, manejar401 } from './auth'
|
||||||
import type { ResumenMiDia } from '../lib/mi-tablero'
|
import type { ResumenMiDia } from '../lib/mi-tablero'
|
||||||
|
|
||||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||||
|
|
||||||
/** GET /mi-dia/resumen; lanza Error con mensaje legible si el API falla */
|
/** GET /mi-dia/resumen; lanza Error con mensaje legible si el API falla */
|
||||||
export async function fetchResumenMiDia(): Promise<ResumenMiDia> {
|
export async function fetchResumenMiDia(): Promise<ResumenMiDia> {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { conAuth, manejar401 } from './auth'
|
import { conAuth, manejar401 } from './auth'
|
||||||
import type { ResumenReportes } from '../lib/reportes'
|
import type { ResumenReportes } from '../lib/reportes'
|
||||||
|
|
||||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||||
|
|
||||||
/** GET /reportes/resumen; lanza Error con mensaje legible si el API falla */
|
/** GET /reportes/resumen; lanza Error con mensaje legible si el API falla */
|
||||||
export async function fetchResumen(): Promise<ResumenReportes> {
|
export async function fetchResumen(): Promise<ResumenReportes> {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import type { ResumenMiDia } from '../lib/mi-dia'
|
import type { ResumenMiDia } from '../lib/mi-dia'
|
||||||
import { conAuth, manejar401 } from './auth'
|
import { conAuth, manejar401 } from './auth'
|
||||||
|
|
||||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||||
|
|
||||||
async function fetchJson<T>(path: string, init: RequestInit = {}): Promise<T> {
|
async function fetchJson<T>(path: string, init: RequestInit = {}): Promise<T> {
|
||||||
const res = await fetch(`${API_URL}${path}`, conAuth(init))
|
const res = await fetch(`${API_URL}${path}`, conAuth(init))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { conAuth, manejar401 } from './auth'
|
import { conAuth, manejar401 } from './auth'
|
||||||
|
|
||||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||||
|
|
||||||
export interface NotaApartado {
|
export interface NotaApartado {
|
||||||
id: string
|
id: string
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { conAuth, manejar401 } from './auth'
|
import { conAuth, manejar401 } from './auth'
|
||||||
|
|
||||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||||
|
|
||||||
/** Convierte la VAPID public key (base64url) a Uint8Array para PushManager */
|
/** Convierte la VAPID public key (base64url) a Uint8Array para PushManager */
|
||||||
function urlBase64ToUint8Array(base64String: string): Uint8Array {
|
function urlBase64ToUint8Array(base64String: string): Uint8Array {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { conAuth, manejar401 } from './auth'
|
import { conAuth, manejar401 } from './auth'
|
||||||
|
|
||||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||||
|
|
||||||
export interface Recordatorio {
|
export interface Recordatorio {
|
||||||
id: string
|
id: string
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { conAuth, manejar401 } from './auth'
|
import { conAuth, manejar401 } from './auth'
|
||||||
|
|
||||||
const API_URL = import.meta.env.VITE_API_URL ?? '/api'
|
const API_URL = import.meta.env.VITE_API_URL || '/api'
|
||||||
|
|
||||||
async function fetchJson<T>(path: string, init: RequestInit = {}): Promise<T> {
|
async function fetchJson<T>(path: string, init: RequestInit = {}): Promise<T> {
|
||||||
const res = await fetch(`${API_URL}${path}`, conAuth(init))
|
const res = await fetch(`${API_URL}${path}`, conAuth(init))
|
||||||
|
|||||||
Reference in New Issue
Block a user