mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
fix: type error in portal
This commit is contained in:
@@ -38,7 +38,16 @@ export const onboardingSchema = z.object({
|
||||
// fields above are read-only confirmations pulled from eTrade).
|
||||
// Region is a closed set; zone/woreda/kebele stay free text until the platform
|
||||
// has an authoritative dataset of Ethiopian zones/woredas/kebeles.
|
||||
region: z.enum(ETHIOPIAN_REGIONS, { message: "Region is required" }),
|
||||
//
|
||||
// Deliberately `.refine` over `z.enum`: the form needs "" as its unselected
|
||||
// sentinel (default value, and legacy rows whose region isn't in the list). A
|
||||
// literal union makes "" untypable, which also splits the resolver's
|
||||
// input/output types and breaks useForm's inference for every other field.
|
||||
region: z
|
||||
.string()
|
||||
.refine((v) => (ETHIOPIAN_REGIONS as readonly string[]).includes(v), {
|
||||
message: "Region is required",
|
||||
}),
|
||||
zone: z.string().min(1, "Zone is required"),
|
||||
woreda: z.string().min(1, "Woreda is required"),
|
||||
kebele: z.string().min(1, "Kebele is required"),
|
||||
|
||||
Reference in New Issue
Block a user