This commit is contained in:
eric
2026-03-16 09:32:35 -05:00
parent c54c236d1b
commit 14b0cd2429
21 changed files with 1058 additions and 706 deletions

View File

@@ -21,7 +21,11 @@ export async function GET(request: NextRequest) {
}
try {
const { status, data } = await getSalonApi(request, `/api/salon/join/by-wechat?wechat_id=${encodeURIComponent(wechatId)}`);
const { status, data } = await getSalonApi(
request,
`/api/salon/join/by-wechat?wechat_id=${encodeURIComponent(wechatId)}`,
{ timeoutMs: 8000 }
);
if (status === 200 && data && typeof data === "object") {
return NextResponse.json(data);
}
@@ -40,13 +44,16 @@ export async function GET(request: NextRequest) {
const filter = encodeURIComponent(`wechatId = "${escaped}"`);
try {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 8000);
const res = await fetch(
`${base}/api/collections/${pb.joinCollection}/records?filter=${filter}&sort=-created&perPage=1`,
{
headers: { Authorization: `Bearer ${token}` },
cache: "no-store",
signal: controller.signal,
}
);
).finally(() => clearTimeout(timeoutId));
if (!res.ok) return NextResponse.json(empty);
const data = await res.json();
const items = Array.isArray(data?.items) ? data.items : [];