From 6e0123836476e95b309edbaa1a27f6958a2ea2ba Mon Sep 17 00:00:00 2001 From: Jake Fulmine Date: Thu, 18 Jul 2024 11:25:00 +0200 Subject: [PATCH] fix: check for empty names before pushing edit --- dashboard/src/components/group/Edit.svelte | 2 ++ dashboard/src/components/member/Edit.svelte | 2 ++ 2 files changed, 4 insertions(+) diff --git a/dashboard/src/components/group/Edit.svelte b/dashboard/src/components/group/Edit.svelte index bad47ab2..c1958454 100644 --- a/dashboard/src/components/group/Edit.svelte +++ b/dashboard/src/components/group/Edit.svelte @@ -25,6 +25,8 @@ err = []; success = false; + if (!data.name) err.push("Group name cannot be empty.") + if (data.color && !/^#?[A-Fa-f0-9]{6}$/.test(input.color)) { err.push(`"${data.color}" is not a valid color, the color must be a 6-digit hex code. (example: #ff0000)`); } else if (data.color) { diff --git a/dashboard/src/components/member/Edit.svelte b/dashboard/src/components/member/Edit.svelte index 6ab730dc..bf9a2734 100644 --- a/dashboard/src/components/member/Edit.svelte +++ b/dashboard/src/components/member/Edit.svelte @@ -24,6 +24,8 @@ let data = input; err = []; + if (!data.name) err.push("Member name cannot be empty.") + if (data.color && !/^#?[A-Fa-f0-9]{6}$/.test(input.color)) { err.push(`"${data.color}" is not a valid color, the color must be a 6-digit hex code. (example: #ff0000)`); } else if (data.color) {