diff --git a/src/actions/user.ts b/src/actions/user.ts index 358c1e3..d72b7bc 100644 --- a/src/actions/user.ts +++ b/src/actions/user.ts @@ -1,7 +1,7 @@ 'use server' import {callByUser, callPublic} from '@/actions/base' -export async function RechargeByPay(props: { +export async function RechargePrepare(props: { amount: string platform: number method: number @@ -12,25 +12,10 @@ export async function RechargeByPay(props: { }>('/api/user/recharge/prepare', props) } -export async function RechargeByAlipayConfirm(props: { +export async function RechargeComplete(props: { trade_no: string }) { - return callByUser('/api/user/recharge/confirm/alipay', props) -} - -export async function RechargeByWechat(props: { - amount: string -}) { - return callByUser<{ - trade_no: string - pay_url: string - }>('/api/user/recharge/prepare/wechat', props) -} - -export async function RechargeByWechatConfirm(props: { - trade_no: string -}) { - return callByUser('/api/user/recharge/confirm/wechat', props) + return callByUser('/api/user/recharge/complete', props) } export async function Identify(props: { diff --git a/src/components/composites/payment/payment.tsx b/src/components/composites/payment/payment.tsx index 2c74a0b..fa8dfb2 100644 --- a/src/components/composites/payment/payment.tsx +++ b/src/components/composites/payment/payment.tsx @@ -1,5 +1,5 @@ 'use client' -import {useState} from 'react' +import {useState, MouseEvent} from 'react' import {Dialog, DialogContent} from '@/components/ui/dialog' import {Button} from '@/components/ui/button' import {CheckCircle, AlertCircle, ClockIcon} from 'lucide-react' @@ -25,7 +25,7 @@ export function PaymentStatusCell({trade}: { const [paymentFailed, setPaymentFailed] = useState(false) const platform = usePlatformType() - const handleClick = (e: React.MouseEvent) => { + const handleClick = (e: MouseEvent) => { e.preventDefault() if (!trade?.pay_url) return @@ -129,7 +129,7 @@ export function PaymentStatusCell({trade}: {