From ce6a00fa25bd12774fa86ee384e840565ecf965b Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 1 Oct 2020 16:45:33 +0200 Subject: Added quotes frontend --- quotes/public/script.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 quotes/public/script.js (limited to 'quotes/public/script.js') diff --git a/quotes/public/script.js b/quotes/public/script.js new file mode 100644 index 0000000..3fbc676 --- /dev/null +++ b/quotes/public/script.js @@ -0,0 +1,28 @@ +const dropdown = document.getElementById("author"); + +dropdown.insertAdjacentHTML("beforeend", ''); + +function append(response) { + response.forEach((elem) => { + dropdown.insertAdjacentHTML( + "beforeend", + `` + ); + }); +} + +// TODO: Add api list endpoint +// fetch("/auth/api/list") +// .then((response) => response.json()) +// .then((response) => append(response)); + +const exampleJson = [ + { id: 1, name: "Lars", middlename: null, surname: "Baum" }, + { id: 2, name: "Marvin", middlename: null, surname: "Giraffe" }, + { id: 3, name: "Dominik", middlename: null, surname: "Apfel" }, + { id: 4, name: "Daniel", middlename: null, surname: "Torte" }, +]; + +append(exampleJson); -- cgit v1.2.3