37 lines
1.1 KiB
HTML
37 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<title>Scenario Management</title>
|
|
</head>
|
|
<body>
|
|
<h1>Create a New Scenario</h1>
|
|
<form id="scenario-form">
|
|
<label>Name: <input type="text" name="name" id="name" required /></label
|
|
><br />
|
|
<label
|
|
>Description:
|
|
<input type="text" name="description" id="description" /></label
|
|
><br />
|
|
<button type="submit">Create Scenario</button>
|
|
</form>
|
|
<div id="result"></div>
|
|
<script>
|
|
document
|
|
.getElementById("scenario-form")
|
|
.addEventListener("submit", async (e) => {
|
|
e.preventDefault();
|
|
const name = document.getElementById("name").value;
|
|
const description = document.getElementById("description").value;
|
|
const resp = await fetch("/api/scenarios/", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({ name, description }),
|
|
});
|
|
const data = await resp.json();
|
|
document.getElementById("result").innerText = JSON.stringify(data);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|