diff --git a/chatdesk-ui/app/[locale]/login/page.tsx b/chatdesk-ui/app/[locale]/login/page.tsx index 3f450c3..a03788e 100644 --- a/chatdesk-ui/app/[locale]/login/page.tsx +++ b/chatdesk-ui/app/[locale]/login/page.tsx @@ -19,28 +19,13 @@ export const metadata: Metadata = { title: "Login" } -interface LoginPageProps { - searchParams: { message: string; email?: string }; - params: { locale: string }; - req: NextPageContext['req']; // 用 NextPageContext 的 req 类型来定义 -} - - -// export default async function Login({ -// searchParams, -// params: { locale }, -// req, // 请求对象 -// }: { -// searchParams: { message: string; email?: string }; -// params: { locale: string }; -// req: Request; // 获取请求对象 -// }) { - export default async function Login({ searchParams, params: { locale }, - req, // 请求对象 -}: LoginPageProps) { +}: { + searchParams: { message: string; email?: string }; + params: { locale: string }; +}) { const cookieStore = cookies() const localeString = locale; @@ -60,31 +45,31 @@ export default async function Login({ .eq("is_home", true) .maybeSingle(); - // Define the clearCookies function for server-side execution - const clearCookies = async () => { - // From request headers or environment variables - let hosturl: string | undefined; + // // Define the clearCookies function for server-side execution + // const clearCookies = async () => { + // // From request headers or environment variables + // let hosturl: string | undefined; - // Option 1: Get host from request headers (useful for dynamic requests) - const hostHeader = req.headers.get('host'); - if (hostHeader) { - hosturl = `http://${hostHeader}`; // Construct full URL - } else { - // Option 2: Use environment variable as fallback - hosturl = process.env.SUPABASE_URL; // Ensure you have this set up in your environment variables - } + // // Option 1: Get host from request headers (useful for dynamic requests) + // const hostHeader = req.headers.get('host'); + // if (hostHeader) { + // hosturl = `http://${hostHeader}`; // Construct full URL + // } else { + // // Option 2: Use environment variable as fallback + // hosturl = process.env.SUPABASE_URL; // Ensure you have this set up in your environment variables + // } - if (hosturl) { - await fetch(`${hosturl}/api/clearcookies`, { - method: "POST", - }); - } else { - console.error("Host URL is not available"); - } - }; + // if (hosturl) { + // await fetch(`${hosturl}/api/clearcookies`, { + // method: "POST", + // }); + // } else { + // console.error("Host URL is not available"); + // } + // }; if (!homeWorkspace) { - await clearCookies(); // Clear cookies if home workspace is not found + //await clearCookies(); // Clear cookies if home workspace is not found return redirect(`/${localeString}/login?message=sessionExpired`); } return redirect(`/${localeString}/${homeWorkspace.id}/chat`);