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 | |
parent | ce4f9770702ee261b238a3466b1e1cf27246dfc8 (diff) | |
parent | 91f4af6e9a3a5d770f98d4a5b75c729c18861cc1 (diff) |
Merge branch 'master' into auth
Diffstat (limited to 'quotes/public')
-rw-r--r-- | quotes/public/index.html | 6 | ||||
-rw-r--r-- | quotes/public/script.js | 17 |
2 files changed, 7 insertions, 16 deletions
diff --git a/quotes/public/index.html b/quotes/public/index.html index abe85cc..0c7b327 100644 --- a/quotes/public/index.html +++ b/quotes/public/index.html @@ -14,13 +14,13 @@ <title>Zitate</title> </head> <body> - <form class="pure-form pure-form-stacked" action="api/submit" method="post"> + <form class="pure-form pure-form-stacked" action="api/add" method="post"> <fieldset> <legend>Zitate</legend> <label for="author">Author</label> - <select name="author" id="author"></select> + <select name="author" id="author" required></select> <label for="quote">Zitat</label> - <input name="quote" type="text" id="quote" placeholder="Zitat" /> + <input name="quote" type="text" id="quote" placeholder="Zitat" required /> <button type="submit" class="pure-button pure-button-primary">Hinzufügen</button> </fieldset> </form> 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)); |