21 lines
482 B
JavaScript
21 lines
482 B
JavaScript
|
|
|
|
export class PuckoPruttApi {
|
|
constructor() {
|
|
this.apiUrl = "https://api.puckoprutt.tech"
|
|
this.schema = this.apiUrl + "/schema/"
|
|
}
|
|
|
|
_fetch_json(url) {
|
|
const response = await fetch(url);
|
|
if (!response.ok) {
|
|
return -1;
|
|
}
|
|
const json = await response.json();
|
|
return json;
|
|
}
|
|
|
|
dagens_lunch(spider) {
|
|
return this._fetch_json(this.apiUrl + "/dagens_lunch/" + spider + "/?format=json");
|
|
}
|
|
} |