From 38efb6a1e2e56d4668f79ea7d6cb1493c1cd91bb Mon Sep 17 00:00:00 2001 From: Vladyslav Matsiiako Date: Tue, 14 Mar 2023 22:07:52 -0700 Subject: [PATCH 1/2] Solved the issue with empty secret names --- frontend/src/pages/dashboard/[id].tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/src/pages/dashboard/[id].tsx b/frontend/src/pages/dashboard/[id].tsx index 6c4483d49..9c485ebba 100644 --- a/frontend/src/pages/dashboard/[id].tsx +++ b/frontend/src/pages/dashboard/[id].tsx @@ -419,9 +419,20 @@ export default function Dashboard() { const nameErrors = !newData! .map((secret) => !Number.isNaN(Number(secret.key.charAt(0)))) .every((v) => v === false); + const emptyNameError = !newData! + .map((secret) => secret.key.length === 0) + .every((v) => v === false); const duplicatesExist = findDuplicates(data!.map((item: SecretDataProps) => item.key)).length > 0; + if (emptyNameError) { + setSaveLoading(false); + return createNotification({ + text: 'You can`t submit empty secret names.', + type: 'error' + }); + } + if (nameErrors) { setSaveLoading(false); return createNotification({ From dabc7e3eb1d0e1ac0cd10a9176a1ed8e8ce23526 Mon Sep 17 00:00:00 2001 From: Vladyslav Matsiiako Date: Tue, 14 Mar 2023 22:13:02 -0700 Subject: [PATCH 2/2] Solved the issue with empty secret names --- frontend/src/pages/dashboard/[id].tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/pages/dashboard/[id].tsx b/frontend/src/pages/dashboard/[id].tsx index 9c485ebba..799c05c39 100644 --- a/frontend/src/pages/dashboard/[id].tsx +++ b/frontend/src/pages/dashboard/[id].tsx @@ -428,7 +428,7 @@ export default function Dashboard() { if (emptyNameError) { setSaveLoading(false); return createNotification({ - text: 'You can`t submit empty secret names.', + text: 'You can`t have empty secret names.', type: 'error' }); }