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

@ -0,0 +1,12 @@
package de.uni_passau.fim.PADAS.group3.DataDash.controler;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class PageController {
@GetMapping("add")
public String getAddPage() {
return "add";
}
}

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();
}
});
});