ScuttleBot

fix: add cache:no-store to all API fetches to prevent stale 301 caching

lmata 2026-04-03 19:37 trunk
Commit a19b71942f74d61d356b704cfc6b139c70cc735f465310d4d731312e567d15d7
1 file changed +1 -1
--- internal/api/ui/index.html
+++ internal/api/ui/index.html
@@ -1238,11 +1238,11 @@
12381238
12391239
document.addEventListener('keydown', e => { if(e.key==='Escape'){ closeDrawer(); closeRegisterUserDrawer(); closeAdoptDrawer(); } });
12401240
12411241
// --- API ---
12421242
async function api(method, path, body) {
1243
- const opts = { method, headers: { 'Authorization':'Bearer '+getToken(), 'Content-Type':'application/json' } };
1243
+ const opts = { method, cache: 'no-store', headers: { 'Authorization':'Bearer '+getToken(), 'Content-Type':'application/json' } };
12441244
if (body !== undefined) opts.body = JSON.stringify(body);
12451245
const res = await fetch(path, opts);
12461246
if (res.status === 401) {
12471247
localStorage.removeItem('sb_token');
12481248
localStorage.removeItem('sb_username');
12491249
--- internal/api/ui/index.html
+++ internal/api/ui/index.html
@@ -1238,11 +1238,11 @@
1238
1239 document.addEventListener('keydown', e => { if(e.key==='Escape'){ closeDrawer(); closeRegisterUserDrawer(); closeAdoptDrawer(); } });
1240
1241 // --- API ---
1242 async function api(method, path, body) {
1243 const opts = { method, headers: { 'Authorization':'Bearer '+getToken(), 'Content-Type':'application/json' } };
1244 if (body !== undefined) opts.body = JSON.stringify(body);
1245 const res = await fetch(path, opts);
1246 if (res.status === 401) {
1247 localStorage.removeItem('sb_token');
1248 localStorage.removeItem('sb_username');
1249
--- internal/api/ui/index.html
+++ internal/api/ui/index.html
@@ -1238,11 +1238,11 @@
1238
1239 document.addEventListener('keydown', e => { if(e.key==='Escape'){ closeDrawer(); closeRegisterUserDrawer(); closeAdoptDrawer(); } });
1240
1241 // --- API ---
1242 async function api(method, path, body) {
1243 const opts = { method, cache: 'no-store', headers: { 'Authorization':'Bearer '+getToken(), 'Content-Type':'application/json' } };
1244 if (body !== undefined) opts.body = JSON.stringify(body);
1245 const res = await fetch(path, opts);
1246 if (res.status === 401) {
1247 localStorage.removeItem('sb_token');
1248 localStorage.removeItem('sb_username');
1249

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button