From 8d25c4d710d0b20dd754895c5a2df7f0a93eb76a Mon Sep 17 00:00:00 2001 From: kevinjj30 Date: Tue, 13 Aug 2019 15:21:27 -0500 Subject: [PATCH] Address book --- 08week/fetch/APi.html | 17 +++++++++++++++++ 08week/fetch/apiAddress.js | 26 ++++++++++++++++++++++++++ 08week/fetch/index.html | 16 ---------------- 08week/fetch/script.js | 1 - 4 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 08week/fetch/APi.html create mode 100644 08week/fetch/apiAddress.js delete mode 100644 08week/fetch/index.html delete mode 100644 08week/fetch/script.js 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';