22 lines
589 B
JavaScript
22 lines
589 B
JavaScript
|
|
|
|
export class PuckoPruttApi {
|
|
constructor() {
|
|
this.apiUrl = "https://api.puckoprutt.tech"
|
|
this.schema = this.apiUrl + "/schema/"
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
async dagens_lunch(spider) {
|
|
return await this._fetch_json("/spiders/dagens_lunch/" + spider + "/?format=json");
|
|
}
|
|
} |