Fix deleting template making a call on empty template list

This commit is contained in:
jude 2023-07-30 17:16:37 +01:00
parent 99eea16f62
commit b8707bbc9a

View File

@ -872,6 +872,7 @@ $loadTemplateBtn.addEventListener("click", (ev) => {
}); });
$deleteTemplateBtn.addEventListener("click", (ev) => { $deleteTemplateBtn.addEventListener("click", (ev) => {
if (parseInt($templateSelect.value) !== null) {
fetch(`/dashboard/api/guild/${guildId()}/templates`, { fetch(`/dashboard/api/guild/${guildId()}/templates`, {
method: "DELETE", method: "DELETE",
headers: { headers: {
@ -889,6 +890,7 @@ $deleteTemplateBtn.addEventListener("click", (ev) => {
.remove(); .remove();
} }
}); });
}
}); });
let $img; let $img;