1
0

In mindflow_admin.js changed mindflow category api path to a new one.

This commit is contained in:
Alexander Andreev 2023-05-27 21:04:45 +04:00
parent 7180b7f35e
commit 5f1724679d
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -32,7 +32,7 @@ document.getElementById("manage-categories").elements["add"].addEventListener("c
ev.preventDefault(); ev.preventDefault();
let data = new URLSearchParams(); let data = new URLSearchParams();
data.append("name", get_field(ev.target, "name")); data.append("name", get_field(ev.target, "name"));
fetch(`/api/mindflow-category`, {method: "POST", body: data}) fetch(`/api/mindflow/category`, {method: "POST", body: data})
.catch(e => console.log(e)) .catch(e => console.log(e))
.then(() => window.location = "/mindflow/admin"); .then(() => window.location = "/mindflow/admin");
}); });
@ -41,14 +41,14 @@ document.getElementById("manage-categories").elements["edit"].addEventListener("
ev.preventDefault(); ev.preventDefault();
let data = new URLSearchParams(); let data = new URLSearchParams();
data.append("name", get_field(ev.target, "name")); data.append("name", get_field(ev.target, "name"));
fetch(`/api/mindflow-category/${get_field(ev.target, "category")}`, {method: "PATCH", body: data}) fetch(`/api/mindflow/category/${get_field(ev.target, "category")}`, {method: "PATCH", body: data})
.catch(e => console.log(e)) .catch(e => console.log(e))
.then(() => window.location = "/mindflow/admin"); .then(() => window.location = "/mindflow/admin");
}); });
document.getElementById("manage-categories").elements["delete"].addEventListener("click", ev => { document.getElementById("manage-categories").elements["delete"].addEventListener("click", ev => {
ev.preventDefault(); ev.preventDefault();
fetch(`/api/mindflow-category/${get_field(ev.target, "category")}`, {method: "DELETE"}) fetch(`/api/mindflow/category/${get_field(ev.target, "category")}`, {method: "DELETE"})
.catch(e => console.log(e)) .catch(e => console.log(e))
.then(() => window.location = "/mindflow/admin"); .then(() => window.location = "/mindflow/admin");
}); });