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 {
getDeviceFromEnv,
} from "@/app/lib/payment";
import type { PayChannel, PayEnv } from "@/app/lib/payment";
import { apiUrl } from "@/app/lib/api-client";
const MEDIA_NAMES_ZH = ["36氪", "少数派", "极客公园", "虎嗅", "创业邦", "澎湃新闻"];
const MEDIA_NAMES_EN = ["36Kr", "sspai", "GeekPark", "Huxiu", "Cyzone", "The Paper"];
@@ -72,7 +73,7 @@ export default function HeroSection() {
useEffect(() => {
const checkAuth = async () => {
try {
const res = await fetch("/api/auth/me", { credentials: "include" });
const res = await fetch(apiUrl("/api/auth/me"), { credentials: "include" });
const data = await res.json();
setIsLoggedIn(!!data?.user);
} catch {
@@ -108,7 +109,7 @@ export default function HeroSection() {
return;
}
}
const checkRes = await fetch("/api/meetup/check-user", {
const checkRes = await fetch(apiUrl("/api/meetup/check-user"), {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email: trimmed }),
@@ -135,7 +136,7 @@ export default function HeroSection() {
isPrivateDevHost(window.location.hostname);
let user_id = buildPendingUserId(trimmed);
if (shouldPrecreateUser) {
const ensureRes = await fetch("/api/meetup/ensure-user", {
const ensureRes = await fetch(apiUrl("/api/meetup/ensure-user"), {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email: trimmed }),
@@ -150,11 +151,11 @@ export default function HeroSection() {
);
}
if (ensureData.is_new) {
await fetch("/api/meetup/set-needs-password-change", { method: "POST", credentials: "include" });
await fetch(apiUrl("/api/meetup/set-needs-password-change"), { method: "POST", credentials: "include" });
}
user_id = String(ensureData.user_id).trim();
if (ensureData?.token && ensureData?.record) {
await fetch("/api/auth/sync-session", {
await fetch(apiUrl("/api/auth/sync-session"), {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ token: ensureData.token, record: ensureData.record }),