From a27820a70994f882b3e756f808a3bf5d5c83f7a4 Mon Sep 17 00:00:00 2001 From: Ebenezer Date: Sat, 10 Nov 2018 20:12:01 +0100 Subject: [PATCH] ch[#161861252] connect products to api Refactor code to enable products list display as flex row --- UI/assets/js/products.js | 9 ++-- UI/pages/products.html | 94 +--------------------------------------- 2 files changed, 6 insertions(+), 97 deletions(-) diff --git a/UI/assets/js/products.js b/UI/assets/js/products.js index af108c3..8dbed13 100644 --- a/UI/assets/js/products.js +++ b/UI/assets/js/products.js @@ -7,12 +7,12 @@ const getProducts = () => { }) .then(res => res.json()) .then((data) => { - let output = null; + let output; data.forEach((user) => { console.log(user.productimage); - output += ` + output = `
-
+
@@ -24,8 +24,9 @@ const getProducts = () => {
`; + document.getElementById('products-list').innerHTML += output; }); - document.getElementById('products-list').innerHTML = output; + document.getElementById('products-list').innerHTML += ''; }); }; diff --git a/UI/pages/products.html b/UI/pages/products.html index 885fd95..9829fbf 100644 --- a/UI/pages/products.html +++ b/UI/pages/products.html @@ -45,99 +45,7 @@
- +