handle rename item being cancelled

This commit is contained in:
Sainan 2024-06-30 11:22:01 +02:00
parent 3aca930f34
commit 9228a8befc

View File

@ -157,7 +157,9 @@ function updateInventory() {
a.onclick = function (event) {
event.preventDefault();
const name = prompt("Enter new custom name:");
renameGear("Suits", item.ItemId.$oid, name);
if (name !== null) {
renameGear("Suits", item.ItemId.$oid, name);
}
};
a.title = "Rename";
a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M0 80V229.5c0 17 6.7 33.3 18.7 45.3l176 176c25 25 65.5 25 90.5 0L418.7 317.3c25-25 25-65.5 0-90.5l-176-176c-12-12-28.3-18.7-45.3-18.7H48C21.5 32 0 53.5 0 80zm112 32a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/></svg>`;
@ -211,7 +213,9 @@ function updateInventory() {
a.onclick = function (event) {
event.preventDefault();
const name = prompt("Enter new custom name:");
renameGear(category, item.ItemId.$oid, name);
if (name !== null) {
renameGear(category, item.ItemId.$oid, name);
}
};
a.title = "Rename";
a.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M0 80V229.5c0 17 6.7 33.3 18.7 45.3l176 176c25 25 65.5 25 90.5 0L418.7 317.3c25-25 25-65.5 0-90.5l-176-176c-12-12-28.3-18.7-45.3-18.7H48C21.5 32 0 53.5 0 80zm112 32a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/></svg>`;