-
-
Notifications
You must be signed in to change notification settings - Fork 13
Fixes for Errors on BoxCreate #2645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
1230f26
5256ea3
3fa103b
f7a4a58
64b5298
9b5a1fa
e6a0a2f
7fb86c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,24 +43,22 @@ export interface IOrganisationBaseData { | |
| } | ||
|
|
||
| // Define schema of the form | ||
| const singleSelectOptionSchema = z.object({ | ||
| const singleSelectOptionSchema = { | ||
| label: z.string(), | ||
| value: z.string(), | ||
| }); | ||
| }; | ||
|
|
||
| const shipmentTargetSchema = z.union([z.literal("partners"), z.literal("currentOrg")]); | ||
|
|
||
| // Define validation checks on form by defining the form schema | ||
| export const ShipmentFormSchema = z.object({ | ||
| shipmentTarget: shipmentTargetSchema, | ||
| receivingOrganisation: singleSelectOptionSchema | ||
| .nullable() | ||
| .refine(Boolean, { error: "Please select an organisation" }) | ||
| .transform((selectedOption) => selectedOption || { label: "", value: "" }), | ||
| receivingBase: singleSelectOptionSchema | ||
| .nullable() | ||
| .refine(Boolean, { error: "Please select a base" }) | ||
| .transform((selectedOption) => selectedOption || { label: "", value: "" }), | ||
| receivingOrganisation: z.object(singleSelectOptionSchema, { | ||
| error: (iss) => (iss.input === undefined ? "Please select an organisation" : "Invalid input."), | ||
| }), | ||
| receivingBase: z.object(singleSelectOptionSchema, { | ||
| error: (iss) => (iss.input === undefined ? "Please select a base" : "Invalid input."), | ||
| }), | ||
|
Comment on lines
54
to
+61
|
||
| }); | ||
|
|
||
| export type ICreateShipmentFormData = z.infer<typeof ShipmentFormSchema>; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.