Less debug. Code clean up. And it uses the Svelte fetch function!! I think it just works...
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user