fix(cache): deshabilitar caché del navegador en llamadas API
Añadido cache: 'no-store' a conAuth() en todas las apps. El navegador cacheaba respuestas GET de la API, causando que los cambios (crear lead, cambiar estado, etc.) no se reflejaran hasta borrar cookies. 6 apps reconstruidas.
This commit is contained in:
@@ -66,7 +66,7 @@ export async function login(username: string, password: string): Promise<Usuario
|
|||||||
export function conAuth(init: RequestInit = {}): RequestInit {
|
export function conAuth(init: RequestInit = {}): RequestInit {
|
||||||
const token = getToken()
|
const token = getToken()
|
||||||
if (!token) return init
|
if (!token) return init
|
||||||
return { ...init, headers: { ...(init.headers as Record<string, string>), Authorization: `Bearer ${token}` } }
|
return { ...init, cache: "no-store", headers: { ...(init.headers as Record<string, string>), Authorization: `Bearer ${token}` } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Si el API responde 401: cierra sesión y recarga para volver al login */
|
/** Si el API responde 401: cierra sesión y recarga para volver al login */
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export async function login(username: string, password: string): Promise<Usuario
|
|||||||
export function conAuth(init: RequestInit = {}): RequestInit {
|
export function conAuth(init: RequestInit = {}): RequestInit {
|
||||||
const token = getToken()
|
const token = getToken()
|
||||||
if (!token) return init
|
if (!token) return init
|
||||||
return { ...init, headers: { ...(init.headers as Record<string, string>), Authorization: `Bearer ${token}` } }
|
return { ...init, cache: "no-store", headers: { ...(init.headers as Record<string, string>), Authorization: `Bearer ${token}` } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Si el API responde 401: cierra sesión y recarga para volver al login */
|
/** Si el API responde 401: cierra sesión y recarga para volver al login */
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export async function login(username: string, password: string): Promise<Usuario
|
|||||||
export function conAuth(init: RequestInit = {}): RequestInit {
|
export function conAuth(init: RequestInit = {}): RequestInit {
|
||||||
const token = getToken()
|
const token = getToken()
|
||||||
if (!token) return init
|
if (!token) return init
|
||||||
return { ...init, headers: { ...(init.headers as Record<string, string>), Authorization: `Bearer ${token}` } }
|
return { ...init, cache: "no-store", headers: { ...(init.headers as Record<string, string>), Authorization: `Bearer ${token}` } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Si el API responde 401: cierra sesión y recarga para volver al login */
|
/** Si el API responde 401: cierra sesión y recarga para volver al login */
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export async function login(username: string, password: string): Promise<Usuario
|
|||||||
export function conAuth(init: RequestInit = {}): RequestInit {
|
export function conAuth(init: RequestInit = {}): RequestInit {
|
||||||
const token = getToken()
|
const token = getToken()
|
||||||
if (!token) return init
|
if (!token) return init
|
||||||
return { ...init, headers: { ...(init.headers as Record<string, string>), Authorization: `Bearer ${token}` } }
|
return { ...init, cache: "no-store", headers: { ...(init.headers as Record<string, string>), Authorization: `Bearer ${token}` } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Si el API responde 401: cierra sesión y recarga para volver al login */
|
/** Si el API responde 401: cierra sesión y recarga para volver al login */
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export async function login(username: string, password: string): Promise<Usuario
|
|||||||
export function conAuth(init: RequestInit = {}): RequestInit {
|
export function conAuth(init: RequestInit = {}): RequestInit {
|
||||||
const token = getToken()
|
const token = getToken()
|
||||||
if (!token) return init
|
if (!token) return init
|
||||||
return { ...init, headers: { ...(init.headers as Record<string, string>), Authorization: `Bearer ${token}` } }
|
return { ...init, cache: "no-store", headers: { ...(init.headers as Record<string, string>), Authorization: `Bearer ${token}` } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Si el API responde 401: cierra sesión y recarga para volver al login */
|
/** Si el API responde 401: cierra sesión y recarga para volver al login */
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export async function login(username: string, password: string): Promise<Usuario
|
|||||||
export function conAuth(init: RequestInit = {}): RequestInit {
|
export function conAuth(init: RequestInit = {}): RequestInit {
|
||||||
const token = getToken()
|
const token = getToken()
|
||||||
if (!token) return init
|
if (!token) return init
|
||||||
return { ...init, headers: { ...(init.headers as Record<string, string>), Authorization: `Bearer ${token}` } }
|
return { ...init, cache: "no-store", headers: { ...(init.headers as Record<string, string>), Authorization: `Bearer ${token}` } }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Si el API responde 401: cierra sesión y recarga para volver al login */
|
/** Si el API responde 401: cierra sesión y recarga para volver al login */
|
||||||
|
|||||||
Reference in New Issue
Block a user