blob: f18cbefb7084dd8b7543bb92c185e4853d91341a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
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);
}
|