add persistence to cart
This commit is contained in:
@@ -38,6 +38,7 @@ const emptyRow = {
|
||||
type BulkProps = {
|
||||
onSubmit: (value: any) => void | Promise<void>
|
||||
courses: Promise<{ hits: Course[] }>
|
||||
defaultValues?: { items: object[] }
|
||||
}
|
||||
|
||||
const item = z.object({
|
||||
@@ -68,11 +69,11 @@ const formSchema = z.object({
|
||||
|
||||
type Schema = z.infer<typeof formSchema>
|
||||
|
||||
export function Bulk({ courses, onSubmit }: BulkProps) {
|
||||
export function Bulk({ courses, onSubmit, defaultValues }: BulkProps) {
|
||||
const wizard = useWizard()
|
||||
const form = useForm({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: { items: [emptyRow] }
|
||||
defaultValues: { items: defaultValues?.items || [emptyRow] }
|
||||
})
|
||||
const {
|
||||
formState,
|
||||
|
||||
Reference in New Issue
Block a user