Less debug. Code clean up. And it uses the Svelte fetch function!! I think it just works...

This commit is contained in:
Scott Idem
2025-05-07 19:49:27 -04:00
parent 7af1d41ff3
commit df3b455c18
7 changed files with 47 additions and 22 deletions

View File

@@ -94,9 +94,15 @@ export let get_object = async function get_object(
console.log('Fetch options:', fetchOptions);
}
let fetch_method: any = fetch;
if (api_cfg.fetch) {
console.log('Using custom fetch function from api_cfg!!!');
fetch_method = api_cfg.fetch;
}
for (let attempt = 1; attempt <= retry_count; attempt++) {
try {
const response = await fetch(url.toString(), fetchOptions)
const response = await fetch_method(url.toString(), fetchOptions)
.catch(function (error) {
console.log('API GET Object *fetch* request was aborted or failed in an unexpected way.', error);
});