@@ -92,7 +93,7 @@ export default function CouponPage() {
]}
/>
-
+
)
}
diff --git a/src/app/(root)/cust/create.tsx b/src/app/(root)/cust/create.tsx
index 6d0ed1f..c5abcba 100644
--- a/src/app/(root)/cust/create.tsx
+++ b/src/app/(root)/cust/create.tsx
@@ -14,6 +14,7 @@ import {
DialogContent,
DialogHeader,
DialogTitle,
+ DialogTrigger,
} from "@/components/ui/dialog"
import {
Field,
@@ -72,16 +73,11 @@ const addUserSchema = z
export type AddUserFormValues = z.infer
interface AddUserDialogProps {
- open: boolean
- onOpenChange: (open: boolean) => void
onSuccess?: () => void
}
-export function AddUserDialog({
- open,
- onOpenChange,
- onSuccess,
-}: AddUserDialogProps) {
+export function AddUserDialog({ onSuccess }: AddUserDialogProps) {
+ const [open, setOpen] = useState(false)
const [isAdding, setIsAdding] = useState(false)
const [discountList, setDiscountList] = useState([])
const [isLoadingDiscount, setIsLoadingDiscount] = useState(false)
@@ -176,7 +172,7 @@ export function AddUserDialog({
const result = await createCust(payload)
if (result?.success) {
toast.success("添加用户成功")
- onOpenChange(false)
+ setOpen(false)
resetAddForm()
onSuccess?.()
} else {
@@ -194,11 +190,14 @@ export function AddUserDialog({
if (!open) {
resetAddForm()
}
- onOpenChange(open)
+ setOpen(open)
}
return (