fix(user): align dto with latest payload
This commit is contained in:
@@ -5,18 +5,18 @@
|
||||
* 流程:
|
||||
* 1. 用户在支付服务托管页完成结账
|
||||
* 2. 支付服务重定向到 `/subscription/success`
|
||||
* 3. 这个页面显示 "购买成功" + 调 `getCurrentUser` 刷新 user
|
||||
* 3. 这个页面显示 "购买成功" + 调 VIP 状态接口确认权益
|
||||
* 4. 点 "返回订阅页" 跳回 `/subscription`
|
||||
*
|
||||
* 注意:权益发放由后端支付服务链路异步完成。
|
||||
* 此页面轮询几次 getCurrentUser 等待 user 状态完成更新。
|
||||
* 此页面轮询几次 VIP 状态接口等待权益完成更新。
|
||||
*/
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { MobileShell } from "@/app/_components/core/mobile-shell";
|
||||
import { authRepository } from "@/data/repositories/auth_repository";
|
||||
import { paymentRepository } from "@/data/repositories/payment_repository";
|
||||
import { ROUTES } from "@/router/routes";
|
||||
|
||||
export default function SubscriptionSuccessPage() {
|
||||
@@ -25,7 +25,7 @@ export default function SubscriptionSuccessPage() {
|
||||
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
||||
const hasRefreshed = useRef(false);
|
||||
|
||||
// 轮询 getCurrentUser 等待后端权益发放完成
|
||||
// 轮询 VIP 状态接口等待后端权益发放完成
|
||||
useEffect(() => {
|
||||
if (hasRefreshed.current) return;
|
||||
hasRefreshed.current = true;
|
||||
@@ -33,7 +33,7 @@ export default function SubscriptionSuccessPage() {
|
||||
let cancelled = false;
|
||||
const tryRefresh = async (attemptsLeft: number) => {
|
||||
if (cancelled) return;
|
||||
const r = await authRepository.getCurrentUser();
|
||||
const r = await paymentRepository.getVipStatus();
|
||||
if (cancelled) return;
|
||||
if (r.success) {
|
||||
if (r.data.isVip) {
|
||||
|
||||
Reference in New Issue
Block a user