akf-forum/views/admin.ejs
Akif9748 4be2069587 3lü ve güçlü
Co-authored-by: Sapphire1525 <Sapphire1525@users.noreply.github.com>

Co-authored-by: inoaa79 <inoaa79@users.noreply.github.com>
2022-08-24 22:09:21 +03:00

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="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/footer") %>
</body>
</html>