Enforce no-cache for API calls
Ensure all API requests include no-cache headers to avoid cached CORS issues. Added Cache-Control, Pragma headers and set fetch to no-store, so requests are not cached. X-Lovable-Edit-ID: edt-17929842-67a4-4e77-8ea7-1e46d2ee30fc
This commit is contained in:
@@ -113,6 +113,8 @@ async function request<T>(
|
||||
): Promise<T> {
|
||||
const headers: Record<string, string> = {
|
||||
'Content-Type': 'application/json',
|
||||
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
||||
'Pragma': 'no-cache',
|
||||
...(options.headers as Record<string, string>),
|
||||
};
|
||||
|
||||
@@ -127,6 +129,7 @@ async function request<T>(
|
||||
const response = await fetch(`${config.api.baseUrl}${endpoint}`, {
|
||||
...options,
|
||||
headers,
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
const json: ApiResponse<T> = await response.json();
|
||||
|
||||
Reference in New Issue
Block a user