feat: add validation to widget edit modal inputs (#879)

* feat: add validation to widget edit modal inputs

* chore: remove unused console.log statements
This commit is contained in:
Meier Lukas authored and GitHub committed 2024-07-28 19:38:19 +02:00
1 parent 851f5e486d
commit 9cb6200895
5 files changed
+74 -43

No files matched your search

+7 -1
View File
@@ -1,6 +1,7 @@
import { objectEntries } from "@homarr/common";
import type { WidgetKind } from "@homarr/definitions";
import type { z, ZodType } from "@homarr/validation";
import type { ZodType } from "@homarr/validation";
import { z } from "@homarr/validation";
import { widgetImports } from ".";
import type { inferSelectOptionValue, SelectOption } from "./_inputs/widget-select-input";
@@ -90,6 +91,11 @@ const optionsFactory = {
longitude: 0,
},
withDescription: input?.withDescription ?? false,
validate: z.object({
name: z.string().min(1),
latitude: z.number(),
longitude: z.number(),
}),
}),
multiText: (input?: CommonInput<string[]> & { validate?: ZodType }) => ({
type: "multiText" as const,