fix: Add cache-busting to API fetch calls
Prevents browser from caching API responses when changing date ranges, which caused stat cards to show stale data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3d3c8a1a54
commit
31a70bbef2
1 changed files with 2 additions and 1 deletions
|
|
@ -37,7 +37,8 @@ const BASE_PATH = window.location.pathname.replace(/\/$/, '');
|
|||
|
||||
async function fetchAPI(endpoint) {
|
||||
const sep = endpoint.includes('?') ? '&' : '?';
|
||||
const res = await fetch(`${BASE_PATH}/api/${endpoint}${sep}${queryParams()}`, { headers: apiHeaders() });
|
||||
const url = `${BASE_PATH}/api/${endpoint}${sep}${queryParams()}&_t=${Date.now()}`;
|
||||
const res = await fetch(url, { headers: apiHeaders(), cache: 'no-store' });
|
||||
if (!res.ok) throw new Error(`API error: ${res.status}`);
|
||||
return res.json();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue