generated from coulomb/repo-seed
Improve dashboard loading and task sync
This commit is contained in:
@@ -28,10 +28,11 @@ export async function waitForVisible(ms) {
|
||||
export async function apiFetch(path, options = {}) {
|
||||
const url = path.startsWith("http") ? path : `${API}${path}`;
|
||||
const timeout = options.timeout ?? FETCH_TIMEOUT;
|
||||
const {timeout: _timeout, ...fetchOptions} = options;
|
||||
const ctrl = new AbortController();
|
||||
const timer = setTimeout(() => ctrl.abort(), timeout);
|
||||
try {
|
||||
return await fetch(url, {...options, signal: ctrl.signal});
|
||||
return await fetch(url, {cache: "no-store", ...fetchOptions, signal: ctrl.signal});
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user