25 lines
629 B
TypeScript
25 lines
629 B
TypeScript
import { NextRequest } from "next/server";
|
|
import { PUBLIC_HUB_JOIN } from "@hub/lib/publicApi";
|
|
import {
|
|
assertPublicKey,
|
|
jsonOk,
|
|
optionsOk,
|
|
} from "~/lib/public-api/http";
|
|
|
|
export async function OPTIONS(req: NextRequest) {
|
|
return optionsOk(req);
|
|
}
|
|
|
|
export async function GET(req: NextRequest) {
|
|
const denied = assertPublicKey(req);
|
|
if (denied) return denied;
|
|
const email = req.nextUrl.searchParams.get("email") || "";
|
|
return jsonOk(req, {
|
|
ok: true,
|
|
...PUBLIC_HUB_JOIN,
|
|
email: email || null,
|
|
isMember: false,
|
|
note: "Hub 中文社区独立加入流程,请前往 pagePath 完成。",
|
|
});
|
|
}
|