修复环境变量问题
This commit is contained in:
@@ -7,6 +7,7 @@ import {PaymentProps} from './type'
|
||||
import {payClose} from '@/actions/resource'
|
||||
import {useEffect} from 'react'
|
||||
import {UniversalDesktopPayment} from './universal-desktop-payment'
|
||||
import {useAppStore} from '@/components/stores/app'
|
||||
|
||||
export type PaymentModalProps = {
|
||||
onConfirm: (showFail: boolean) => Promise<void>
|
||||
@@ -34,9 +35,10 @@ export function PaymentModal(props: PaymentModalProps) {
|
||||
}
|
||||
|
||||
// SSE处理方式检查支付状态
|
||||
const apiUrl = useAppStore('apiUrl')
|
||||
useEffect(() => {
|
||||
const eventSource = new EventSource(
|
||||
`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/trade/check?trade_no=${props.inner_no}&method=${props.method}`,
|
||||
`${apiUrl}/api/trade/check?trade_no=${props.inner_no}&method=${props.method}`,
|
||||
)
|
||||
eventSource.onmessage = async (event) => {
|
||||
switch (event.data) {
|
||||
@@ -53,7 +55,7 @@ export function PaymentModal(props: PaymentModalProps) {
|
||||
return () => {
|
||||
eventSource.close()
|
||||
}
|
||||
}, [props])
|
||||
}, [apiUrl, props])
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
|
||||
Reference in New Issue
Block a user