This commit is contained in:
eric
2026-06-06 04:29:46 -05:00
parent 88aa96a2a1
commit 41493c35ca
50 changed files with 4666 additions and 416 deletions

View File

@@ -10,6 +10,7 @@ import {
import { usePayStatusPoll } from "@/app/lib/payment/usePayStatusPoll";
import type { PayEnv } from "@/app/lib/payment";
import AuthModal from "@/app/components/AuthModal";
import { apiUrl } from "@/app/lib/api-client";
const genderOptions = ["男", "女"];
const singleOptions = ["单身", "恋爱中", "已婚"];
@@ -67,13 +68,13 @@ export default function JoinPage() {
return;
}
const checkExisting = async () => {
const meRes = await fetch("/api/auth/me", { credentials: "include" });
const meRes = await fetch(apiUrl("/api/auth/me"), { credentials: "include" });
const meData = await meRes.json();
if (!meData?.user) {
setCheckingStatus(false);
return;
}
const statusRes = await fetch("/api/join/status", { credentials: "include", cache: "no-store" });
const statusRes = await fetch(apiUrl("/api/join/status"), { credentials: "include", cache: "no-store" });
const statusData = await statusRes.json();
if (statusData?.hasRecord && statusData?.isComplete) {
setIsAlreadyRecorded(true);
@@ -105,7 +106,7 @@ export default function JoinPage() {
setError(null);
setSubmitting(true);
try {
const res = await fetch("/api/join", {
const res = await fetch(apiUrl("/api/join"), {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ ...form, media: media?.url }),
@@ -121,7 +122,7 @@ export default function JoinPage() {
return;
}
// 再次确认 VIP,防止 handleAuthSuccess 等路径绕过
const vipRes2 = await fetch("/api/vip/check", { credentials: "include", cache: "no-store" });
const vipRes2 = await fetch(apiUrl("/api/vip/check"), { credentials: "include", cache: "no-store" });
const vipData2 = await vipRes2.json();
if (vipData2?.vip) {
setIsVipSubmit(true);
@@ -152,14 +153,14 @@ export default function JoinPage() {
const handleSubmit = async (e: FormEvent) => {
e.preventDefault();
const meRes = await fetch("/api/auth/me", { credentials: "include" });
const meRes = await fetch(apiUrl("/api/auth/me"), { credentials: "include" });
const meData = await meRes.json();
if (!meData?.user) {
setPendingSubmit(true);
setAuthOpen(true);
return;
}
const vipRes = await fetch("/api/vip/check", { credentials: "include", cache: "no-store" });
const vipRes = await fetch(apiUrl("/api/vip/check"), { credentials: "include", cache: "no-store" });
const vipData = await vipRes.json();
if (vipData?.vip) {
setIsVipSubmit(true);
@@ -401,7 +402,7 @@ export default function JoinPage() {
try {
const fd = new FormData();
fd.append("file", file);
const res = await fetch("/api/upload-media", {
const res = await fetch(apiUrl("/api/upload-media"), {
method: "POST",
body: fd,
});