akf-forum/views/admin.ejs
2022-08-26 16:27:29 +03:00

40 lines
No EOL
1 KiB
Text

<!DOCTYPE html>
<html lang="en">
<%- include("extra/old_header", {title: "Admin panel!" }) %>
<body>
<%- include("extra/old_navbar", {user}) %>
<h1>Welcome to the admin panel of the forum, <%= user.name %>!</h1>
<form>
<h2>Write an ID to give someone admin permissions:</h2>
<input name="userid"></input>
<hr>
<button class="big" type="submit">Give admin permissions!</button>
</form>
<script type="module">
import request from "../../js/request.js";
document.addEventListener("submit", async e => {
e.preventDefault();
const response = await request("/api/users/" + e.target[0].value + "/admin");
if (response.admin)
alert("Making admin of "+response.name+" is success!");
});
</script>
<%- include("extra/old_footer") %>
</body>
</html>