ScuttleBot
fix: add cache:no-store to all API fetches to prevent stale 301 caching
Commit
a19b71942f74d61d356b704cfc6b139c70cc735f465310d4d731312e567d15d7
Parent
1cbc747d348b826…
1 file changed
+1
-1
+1
-1
| --- internal/api/ui/index.html | ||
| +++ internal/api/ui/index.html | ||
| @@ -1238,11 +1238,11 @@ | ||
| 1238 | 1238 | |
| 1239 | 1239 | document.addEventListener('keydown', e => { if(e.key==='Escape'){ closeDrawer(); closeRegisterUserDrawer(); closeAdoptDrawer(); } }); |
| 1240 | 1240 | |
| 1241 | 1241 | // --- API --- |
| 1242 | 1242 | 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' } }; | |
| 1244 | 1244 | if (body !== undefined) opts.body = JSON.stringify(body); |
| 1245 | 1245 | const res = await fetch(path, opts); |
| 1246 | 1246 | if (res.status === 401) { |
| 1247 | 1247 | localStorage.removeItem('sb_token'); |
| 1248 | 1248 | localStorage.removeItem('sb_username'); |
| 1249 | 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, 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 |