Integrate add content page into backend
The page can be found under `/add`.
This commit is contained in:
parent
1864e49264
commit
4c8437be92
@ -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";
|
||||||
|
}
|
||||||
|
}
|
@ -46,11 +46,14 @@ form.addEventListener("submit", e => {
|
|||||||
fetch("/api/v1/datasets", {
|
fetch("/api/v1/datasets", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify(newContent),
|
body: JSON.stringify(newContent),
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json;charset=utf-8"
|
||||||
|
}
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
if (response.status == 200) {
|
if (response.status == 200) {
|
||||||
location.assign("/");
|
location.assign("/");
|
||||||
} else {
|
} else {
|
||||||
addBtn.disabled = !checkValidity();
|
addBtn.disabled = !form.checkValidity();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user