initial commit

This commit is contained in:
felix
2026-09-16 17:16:19 +02:00
commit d120237521
80 changed files with 26582 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import { JSONAPIAdapter } from '@warp-drive/legacy/adapter/json-api';
export default class ApplicationAdapter extends JSONAPIAdapter {
ajax(url, method) {
if (method !== 'GET') return super.ajax(...arguments);
return retryOnError(super.ajax.bind(this), arguments);
}
}
async function retryOnError(ajax, ajaxArgs, retryCount = 0) {
const MAX_RETRIES = 6;
try {
return await ajax(...ajaxArgs);
} catch (error) {
if (retryCount < MAX_RETRIES) {
await sleep(250 * (retryCount + 1));
return retryOnError(ajax, ajaxArgs, retryCount + 1);
} else {
throw error;
}
}
}
function sleep(time) {
return new Promise((resolve) => setTimeout(() => resolve(true), time));
}