Integrate add content page into backend

The page can be found under `/add`.
This commit is contained in:
Elias Schriefer
2024-06-24 17:40:07 +02:00
parent 1864e49264
commit 4c8437be92
2 changed files with 16 additions and 1 deletions

View File

@@ -46,11 +46,14 @@ form.addEventListener("submit", e => {
fetch("/api/v1/datasets", {
method: "POST",
body: JSON.stringify(newContent),
headers: {
"Content-Type": "application/json;charset=utf-8"
}
}).then(response => {
if (response.status == 200) {
location.assign("/");
} else {
addBtn.disabled = !checkValidity();
addBtn.disabled = !form.checkValidity();
}
});
});