返回 CodeWhale
page.tsx
根目录 / web / app / [locale] / auth / callback / page.tsx
1 import { redirect } from "next/navigation";
2 import { APP_AUTH_CALLBACK_URL } from "@/lib/public-auth-routes";
3
4 /**
5 * Fallback if a localized `/<locale>/auth/callback` reaches the page
6 * renderer. Middleware already hops this to the CWC app; keep the same
7 * destination so a missed middleware match cannot 404.
8 */
9 export default async function PublicAuthCallbackPage({
10 searchParams,
11 }: {
12 searchParams: Promise<Record<string, string | string[] | undefined>>;
13 }) {
14 const params = await searchParams;
15 const destination = new URL(APP_AUTH_CALLBACK_URL);
16 for (const [key, value] of Object.entries(params)) {
17 if (typeof value === "string") destination.searchParams.set(key, value);
18 else if (Array.isArray(value)) {
19 for (const item of value) destination.searchParams.append(key, item);
20 }
21 }
22 redirect(destination.toString());
23 }
24
24 lines Plain Text