update pay ui

This commit is contained in:
2025-12-13 16:30:50 +08:00
parent ed9d49da01
commit 4ccd43f025
17 changed files with 67 additions and 43 deletions

View File

@@ -53,6 +53,7 @@ import {
FaChevronDown,
FaChevronUp,
} from 'react-icons/fa';
import { getApiBase } from '../../utils/apiConfig';
export default function SubscriptionContent() {
// Auth context
@@ -129,7 +130,7 @@ export default function SubscriptionContent() {
const fetchSubscriptionPlans = async () => {
try {
logger.debug('SubscriptionContent', '正在获取订阅套餐');
const response = await fetch('/api/subscription/plans');
const response = await fetch(`${getApiBase()}/api/subscription/plans`);
if (response.ok) {
const data = await response.json();
@@ -175,7 +176,7 @@ export default function SubscriptionContent() {
validPromoCode
});
const response = await fetch('/api/subscription/calculate-price', {
const response = await fetch(`${getApiBase()}/api/subscription/calculate-price`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@@ -307,7 +308,7 @@ export default function SubscriptionContent() {
orderId: null // Will be set after order creation
});
const response = await fetch('/api/payment/create-order', {
const response = await fetch(`${getApiBase()}/api/payment/create-order`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@@ -379,7 +380,7 @@ export default function SubscriptionContent() {
const checkInterval = setInterval(async () => {
try {
const response = await fetch(`/api/payment/order/${orderId}/status`, {
const response = await fetch(`${getApiBase()}/api/payment/order/${orderId}/status`, {
credentials: 'include'
});
@@ -456,7 +457,7 @@ export default function SubscriptionContent() {
setForceUpdating(true);
try {
const response = await fetch(`/api/payment/order/${paymentOrder.id}/force-update`, {
const response = await fetch(`${getApiBase()}/api/payment/order/${paymentOrder.id}/force-update`, {
method: 'POST',
credentials: 'include'
});
@@ -517,7 +518,7 @@ export default function SubscriptionContent() {
setCheckingPayment(true);
try {
const response = await fetch(`/api/payment/order/${paymentOrder.id}/status`, {
const response = await fetch(`${getApiBase()}/api/payment/order/${paymentOrder.id}/status`, {
credentials: 'include'
});