's'
This commit is contained in:
@@ -84,12 +84,13 @@ export default function JoinPage() {
|
||||
checkExisting();
|
||||
}, []);
|
||||
|
||||
// 轮询到支付成功时跳转到 /join/paid,避免在 /join 重复显示成功页
|
||||
usePayStatusPoll(() => {
|
||||
// 轮询到支付成功时跳转到 /join/paid,携带 order_id 供 complete-order 使用
|
||||
usePayStatusPoll((orderId) => {
|
||||
if (typeof window === "undefined") return;
|
||||
const path = window.location.pathname;
|
||||
const paidPath = path.replace(/\/join\/?$/, "") + "/join/paid";
|
||||
window.location.replace(paidPath);
|
||||
const url = orderId ? `${paidPath}?order_id=${encodeURIComponent(orderId)}` : paidPath;
|
||||
window.location.replace(url);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -53,18 +53,32 @@ export default function JoinPaidPage() {
|
||||
pbSaveAuth(d.token, d.record);
|
||||
}
|
||||
window.dispatchEvent(new CustomEvent("auth:updated"));
|
||||
setTimeout(() => window.dispatchEvent(new CustomEvent("auth:updated")), 500);
|
||||
window.dispatchEvent(new CustomEvent("vip:updated"));
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(new CustomEvent("auth:updated"));
|
||||
window.dispatchEvent(new CustomEvent("vip:updated"));
|
||||
}, 400);
|
||||
if (d.is_new) {
|
||||
await fetch("/api/meetup/set-needs-password-change", { method: "POST", credentials: "include" });
|
||||
if (!cancelled) {
|
||||
setNeedPasswordChange(true);
|
||||
setShowPasswordModal(true);
|
||||
}
|
||||
} else {
|
||||
const needRes = await fetch("/api/meetup/need-password-change", { credentials: "include" });
|
||||
const needData = await needRes.json().catch(() => ({}));
|
||||
if (!cancelled && needData?.need === true) {
|
||||
setNeedPasswordChange(true);
|
||||
setShowPasswordModal(true);
|
||||
}
|
||||
}
|
||||
return { ok: true };
|
||||
};
|
||||
|
||||
const run = async () => {
|
||||
const urlOrderId = typeof window !== "undefined"
|
||||
? new URLSearchParams(window.location.search).get("order_id") || ""
|
||||
: "";
|
||||
const cookie = document.cookie.split(";").find((c) => c.trim().startsWith("join_pay_order="));
|
||||
const rawValue = cookie?.split("=")[1]?.trim();
|
||||
const storageValue = (() => {
|
||||
@@ -75,7 +89,7 @@ export default function JoinPaidPage() {
|
||||
}
|
||||
})();
|
||||
const decoded = rawValue ? decodeURIComponent(rawValue) : storageValue;
|
||||
const orderId = decoded.split("|")[0]?.trim() || "";
|
||||
const orderId = urlOrderId || decoded.split("|")[0]?.trim() || "";
|
||||
if (!orderId) {
|
||||
clearPendingOrder();
|
||||
window.location.replace(`/${window.location.pathname.split("/")[1] || "zh"}/join`);
|
||||
|
||||
Reference in New Issue
Block a user