Allow duplicate category feedback via submission

This commit is contained in:
beatz174-bit
2025-12-01 15:28:52 +10:00
parent 115c520b22
commit 166b486ad7
+2 -6
View File
@@ -20,12 +20,8 @@ const ManageCategoriesScreen = () => {
}, {}); }, {});
}, [categories, products]); }, [categories, products]);
const validateCategoryName = (value: string, editingId?: string | null) => { const validateCategoryName = (value: string) => {
const trimmed = value.trim(); return Boolean(value.trim());
if (!trimmed) return false;
return !categories.some(
(category) => category.id !== editingId && category.name.toLowerCase() === trimmed.toLowerCase(),
);
}; };
const addCategory = async (name: string): Promise<ActionOutcome> => { const addCategory = async (name: string): Promise<ActionOutcome> => {