akf-forum/views/admin.ejs

40 lines
No EOL
1 KiB
Text

<!DOCTYPE html>
<html lang="en">
<%- include("extra/header", {title: "Admin panel!" }) %>
<body>
<%- include("extra/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="buyuk" 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.result.admin)
alert("Making admin of "+response.result.name+" is success!");
});
</script>
<%- include("extra/footer") %>
</body>
</html>