Skip to content

Commit 1232c46

Browse files
committed
fix: notification validation refines
- shows required-error if minLength check fails, since then the input is left empty
1 parent d058065 commit 1232c46

File tree

1 file changed

+4
-4
lines changed
  • frontend/apps/staff/src/pages/notifications/[id]

1 file changed

+4
-4
lines changed

frontend/apps/staff/src/pages/notifications/[id]/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ function getHTMLMessageSchema(minLength: number, maxLength: number) {
8383
.string()
8484
.max(1000)
8585
.transform(cleanHtmlContent)
86-
.refine((x) => stripHtml(x).length < minLength, {
87-
message: `Message cannot be shorter than ${minLength} characters`,
86+
.refine((x) => stripHtml(x).length >= minLength, {
87+
error: `Required`,
8888
})
89-
.refine((x) => stripHtml(x).length > maxLength, {
90-
message: `Message cannot be longer than ${maxLength} characters`,
89+
.refine((x) => stripHtml(x).length <= maxLength, {
90+
error: `Message cannot be longer than ${maxLength} characters`,
9191
});
9292
}
9393

0 commit comments

Comments
 (0)