diff --git a/module.json b/module.json index 344cd9d..790415b 100644 --- a/module.json +++ b/module.json @@ -6,7 +6,7 @@ "authors": [ { "name": "Robin Riis" } ], - "version": "0.1.26", + "version": "0.1.27", "socket": true, "minimumCoreVersion": 10, "compatibility": { diff --git a/scripts/puckoapi/puckoapi.js b/scripts/puckoapi/puckoapi.js index f7e1441..a64622f 100644 --- a/scripts/puckoapi/puckoapi.js +++ b/scripts/puckoapi/puckoapi.js @@ -7,16 +7,10 @@ export class PuckoPruttApi { } async _fetch_json(url) { - ret = "Could not fetch "+url - const response = await fetch(this.apiUrl + url).then( - response => response.json() - ).then(data => ret = data).catch( - error => console.error("Error: ", error) - ); - return ret + return await foundry.utils.fetchJsonWithTimeout(this.apiUrl + url) } async dagens_lunch(spider) { - return await this._fetch_json("/spiders/dagens_lunch/" + spider + "/?format=json"); + return this._fetch_json("/spiders/dagens_lunch/" + spider + "/?format=json"); } } \ No newline at end of file