You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
420 B
21 lines
420 B
|
|
class GetJson {
|
|
constructor(url) {
|
|
this.url = url;
|
|
this.items = [];
|
|
this.item = undefined;
|
|
}
|
|
|
|
async theData() {
|
|
const resp = await fetch(this.url);
|
|
console.assert(resp.status == 200, "failed to get it");
|
|
this.items = await resp.json();
|
|
return this.items;
|
|
}
|
|
|
|
async oneThing() {
|
|
this.item = await this.theData();
|
|
console.log("ITEMS", this.items);
|
|
return this.item;
|
|
}
|
|
}
|
|
|