admin page (in progress)
This commit is contained in:
22
static/html/admin.html
Normal file
22
static/html/admin.html
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport"
|
||||||
|
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<base href="/" target="_top">
|
||||||
|
<script src="static/js/admin.js" defer="defer"></script>
|
||||||
|
<title>Administration</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<h1>Users</h1>
|
||||||
|
<div id="users"></div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h1>Votes</h1>
|
||||||
|
<div id="votes"></div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
20
static/js/admin.js
Normal file
20
static/js/admin.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
async function run() {
|
||||||
|
let users = await fetch("/admin/users").then(r => r.json());
|
||||||
|
|
||||||
|
let usersDiv = document.getElementById("users");
|
||||||
|
for (let i = 0; i < users.length; i++) {
|
||||||
|
let item = document.createElement("div");
|
||||||
|
let username = document.createElement("p");
|
||||||
|
let permissions = document.createElement("p");
|
||||||
|
username.textContent = users[i][0];
|
||||||
|
permissions.textContent = users[i][1];
|
||||||
|
item.style.display = "flex";
|
||||||
|
item.append(username, permissions);
|
||||||
|
usersDiv.appendChild(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
// let votes = await fetch("/admin/votes").then(r => r.json());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
let _ = run();
|
||||||
Reference in New Issue
Block a user