-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
44 lines (37 loc) · 1.23 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
let apiData
/* on window load */
window.onload = () => {
getApiData();
}
function getApiData() {
fetch("https://airfry-api.herokuapp.com/api")
.then(res => res.json()) // parse response as JSON
.then(data => {
//printTest("On window load, get spell list", JSON.stringify(data, null, 4))
apiData = data
})
.catch(err => {
console.log(`error ${err}`)
});
}
console.log("main.js got the data!")
console.log(JSON.stringify(apiData, null, 2))
function getCategoryData() {
// fetch("https://airfry-api.herokuapp.com/api")
// .then(res => res.json()) // parse response as JSON
// .then(data => {
// //printTest("On window load, get spell list", JSON.stringify(data, null, 4))
// data.results.forEach(spell => {
// // console.log(spell.name)
// spellList.push((spell.name).replace("'", "'"))
// });
// //console.log(spellList)
// /* initiate autocomplete */
// autocomplete(document.getElementById("myInput"), spellList);
// })
// .catch(err => {
// console.log(`error ${err}`)
// });
}
function getTypeData() {
}