diff options
author | Lars Krönner | 2020-10-01 17:52:50 +0200 |
---|---|---|
committer | GitHub | 2020-10-01 17:52:50 +0200 |
commit | 6a18abb61acc70a90d9a4401dd5b6a6f43040800 (patch) | |
tree | c62c1d582c99def9c89c63cde56e88bcd3da7ada /quotes/public/script.js | |
parent | ce4f9770702ee261b238a3466b1e1cf27246dfc8 (diff) | |
parent | 91f4af6e9a3a5d770f98d4a5b75c729c18861cc1 (diff) |
Merge branch 'master' into auth
Diffstat (limited to 'quotes/public/script.js')
-rw-r--r-- | quotes/public/script.js | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/quotes/public/script.js b/quotes/public/script.js index 3fbc676..7a87486 100644 --- a/quotes/public/script.js +++ b/quotes/public/script.js @@ -6,7 +6,7 @@ function append(response) { response.forEach((elem) => { dropdown.insertAdjacentHTML( "beforeend", - `<option ${elem["id"]}>${elem["name"]} ${elem["middlename"] ? elem["middlename"] : " "}${ + `<option value="${elem["id"]}">${elem["name"]} ${elem["middlename"] ? elem["middlename"] : " "}${ elem["surname"] }</option>` ); @@ -14,15 +14,6 @@ function append(response) { } // 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); +fetch("/auth/api/list") + .then((response) => response.json()) + .then((response) => append(response)); |