diff --git a/08week/fetch/APi.html b/08week/fetch/APi.html new file mode 100644 index 000000000..5e01c79bb --- /dev/null +++ b/08week/fetch/APi.html @@ -0,0 +1,17 @@ + + + + + + Fetch Address Book + + +
+ +
+

All Posts

+ +
+ + + \ No newline at end of file diff --git a/08week/fetch/apiAddress.js b/08week/fetch/apiAddress.js new file mode 100644 index 000000000..a00088893 --- /dev/null +++ b/08week/fetch/apiAddress.js @@ -0,0 +1,26 @@ +"use strict"; + +function catchError(result) { + if (!result.ok) { + throw Error(result.message); + } + return result; +} +function getAPI() { + fetch("https://randomuser.me/api/?results=500") + .then(result => result.json()) + .then(data => { + let output = `

Friends

`; + data.results.forEach(function(user) { + output += ` + faces + + `; + }); + document.getElementById("container").innerHTML = output; + }); +} diff --git a/08week/fetch/index.html b/08week/fetch/index.html deleted file mode 100644 index 6417d858f..000000000 --- a/08week/fetch/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - Fetch - - - - -
- - - - - - diff --git a/08week/fetch/script.js b/08week/fetch/script.js deleted file mode 100644 index ad9a93a7c..000000000 --- a/08week/fetch/script.js +++ /dev/null @@ -1 +0,0 @@ -'use strict';