Fix caching
This commit is contained in:
@@ -442,13 +442,15 @@
|
|||||||
async function apiFetch(method, body) {
|
async function apiFetch(method, body) {
|
||||||
const opts = {
|
const opts = {
|
||||||
method,
|
method,
|
||||||
|
cache: "no-store",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
...authHeaders(),
|
...authHeaders(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if (body !== undefined) opts.body = JSON.stringify(body);
|
if (body !== undefined) opts.body = JSON.stringify(body);
|
||||||
const res = await fetch(API, opts);
|
const url = method === "GET" ? API + "?_t=" + Date.now() : API;
|
||||||
|
const res = await fetch(url, opts);
|
||||||
if (res.status === 401 || res.status === 403)
|
if (res.status === 401 || res.status === 403)
|
||||||
throw new Error("AUTH");
|
throw new Error("AUTH");
|
||||||
if (!res.ok) throw new Error("HTTP " + res.status);
|
if (!res.ok) throw new Error("HTTP " + res.status);
|
||||||
|
|||||||
Reference in New Issue
Block a user