refac: ui optimisation

This commit is contained in:
Timothy J. Baek 2024-10-16 22:41:16 -07:00
parent 29c39d44e1
commit e421be5759

View File

@ -140,8 +140,6 @@
});
const nameUpdateHandler = async () => {
name = name.trim();
if (name === '') {
toast.error("Folder name can't be empty");
return;
@ -152,8 +150,15 @@
return;
}
const currentName = folders[folderId].name;
name = name.trim();
folders[folderId].name = name;
const res = await updateFolderNameById(localStorage.token, folderId, name).catch((error) => {
toast.error(error);
folders[folderId].name = currentName;
return null;
});