mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-12-23 16:19:08 +03:00
41 lines
No EOL
1 KiB
Text
41 lines
No EOL
1 KiB
Text
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<%- include("extra/meta", {title: "Create Category!" }) %>
|
|
|
|
<body>
|
|
<link rel="stylesheet" href="/css/create_thread.css" />
|
|
|
|
<%- include("extra/navbar") %>
|
|
|
|
<form>
|
|
<h2 class="title" style="align-self: baseline;">Name:</h2>
|
|
<input name="name" class="input" required ></input>
|
|
<h2 class="title" style="align-self: baseline;">Description:</h2>
|
|
<textarea rows="4" cols="50" name="desp" class="input" required></textarea>
|
|
<button class="btn-primary" style="width:100%" type="submit">Create Category!</button>
|
|
</form>
|
|
|
|
|
|
<script type="module">
|
|
import request from "../../js/request.js";
|
|
|
|
document.addEventListener("submit", async e => {
|
|
e.preventDefault();
|
|
const data = new FormData(e.target);
|
|
|
|
const response = await request("/api/categories/", "POST", {
|
|
name: data.get("name"),
|
|
desp: data.get("desp")
|
|
});
|
|
|
|
if (response)
|
|
window.location.href = "/categories/" + response.id;
|
|
|
|
|
|
});
|
|
</script>
|
|
<%- include("extra/footer") %>
|
|
|
|
</body>
|
|
|
|
</html> |