grand commit

This commit is contained in:
2025-02-07 08:34:42 +02:00
parent f594f001f6
commit c6c34f0453
53 changed files with 1283 additions and 625 deletions

View File

@@ -4,15 +4,14 @@ import {zodResolver} from '@hookform/resolvers/zod'
import dynamic from 'next/dynamic'
import React, {useEffect, useMemo, useRef, useState} from 'react'
import {useFieldArray, useForm} from 'react-hook-form'
import toast from 'react-hot-toast'
import {z} from 'zod'
import {onProductCreateAction} from '@/actions/admin/product'
import {useToast} from '@/hooks/use-toast'
import {i18nDefaultLocale, i18nLocales} from '@/i18n-config'
import {BaseEditorConfig} from '@/lib/config/editor'
import {createProductFormSchema} from '@/lib/schemas/admin/product'
import {toEmptyParams} from '@/lib/utils'
import useCountStore from '@/store/cart-store'
import {Button} from '@/ui/button'
import {
Form,
@@ -64,7 +63,6 @@ export default function ProductCreateEditForm({data}: {data?: any}) {
data?.locales[1].instruction || ''
)
const editor = useRef(null) //declared a null value
const {toast} = useToast()
const config = useMemo(() => BaseEditorConfig, [])
@@ -129,20 +127,12 @@ export default function ProductCreateEditForm({data}: {data?: any}) {
setError(res?.error)
setSuccess('')
setLoading(false)
toast({
variant: 'destructive',
title: res?.error,
description: res?.message
})
toast.error(res?.error)
} else {
setSuccess(res?.success as string)
setError('')
setLoading(false)
toast({
variant: 'success',
title: res?.success,
description: res?.message
})
toast.success(res?.success)
}
})
}