Basic API kind of worked out and solved a bunch of things with alpine.js
This commit is contained in:
parent
f49608d74c
commit
07fa59c8e7
12 changed files with 149 additions and 61 deletions
15
public/js/code.js
Normal file
15
public/js/code.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
class GetJson {
|
||||
constructor(url) {
|
||||
this.url = url;
|
||||
this.items = [];
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue