diff options
| author | Daniel Hader <[email protected]> | 2026-05-22 16:57:58 -0500 |
|---|---|---|
| committer | Daniel Hader <[email protected]> | 2026-05-22 16:57:58 -0500 |
| commit | 86555bd1f89154394f4e997786896e710dd2ba1b (patch) | |
| tree | fe269559b6b4191a6f5ecd84465bb066f63a4614 /static/main.js | |
| parent | 92436c8bb9eafcc56219e784f8b374edfb1907a3 (diff) | |
JWT encoding and minor cosmetic changes
Diffstat (limited to 'static/main.js')
| -rw-r--r-- | static/main.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/static/main.js b/static/main.js new file mode 100644 index 0000000..e0c0b3e --- /dev/null +++ b/static/main.js @@ -0,0 +1,42 @@ +async function login() { + +} + +async function fetch_problems() { + const response = await fetch("/problem"); + if (!response.ok) { + console.log("ummm"); + } + + const result = await response.json(); + console.log(result); + + const problems_div = document.getElementById("problems"); + while (problems_div.firstChild) { + problems_div.removeChild(problems_div.lastChild); + } + + for (const problem of result) { + const problem_div = document.createElement("div"); + problem_div.className = "problem"; + problems_div.appendChild(problem_div); + + const title = document.createElement("h2"); + title.innerHTML = problem.title; + problem_div.appendChild(title); + + const description = document.createElement("p"); + description.innerHTML = problem.description; + problem_div.appendChild(description); + } +} + +async function on_load() { + await fetch_problems(); + + const login_anchor = document.createElement("a"); + login_anchor.innerText = "Login / Register"; + login_anchor.href="google.com"; + document.getElementById("login-notice").appendChild(login_anchor); + +} |
