From cf6b20f4a51ea3d0861780449b9aa606d9e6fd58 Mon Sep 17 00:00:00 2001 From: hailin Date: Wed, 21 May 2025 16:08:52 +0800 Subject: [PATCH] . --- chatdesk-ui/app/[locale]/login/page.tsx | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/chatdesk-ui/app/[locale]/login/page.tsx b/chatdesk-ui/app/[locale]/login/page.tsx index 07402ca..aad6371 100644 --- a/chatdesk-ui/app/[locale]/login/page.tsx +++ b/chatdesk-ui/app/[locale]/login/page.tsx @@ -31,18 +31,6 @@ export default async function Login({ const localeString = locale; const { t, resources } = await initTranslations(localeString, ['translation']); - // const supabase = createServerClient( - // getRuntimeEnv("SUPABASE_URL") ?? "http://localhost:8000", - // process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, - // { - // cookies: { - // get(name: string) { - // return cookieStore.get(name)?.value - // } - // } - // } - // ) - const supabase = getSupabaseServerClient() const session = (await supabase.auth.getSession()).data.session @@ -57,10 +45,16 @@ export default async function Login({ .eq("is_home", true) .maybeSingle(); + // Define the clearCookies function const clearCookies = async () => { - await fetch("/api/clearCookies", { - method: "POST", - }); + const storedUrl = localStorage.getItem("supabaseUrl"); + if (storedUrl) { + await fetch(`${storedUrl}/api/clearcookies`, { + method: "POST", + }); + } else { + console.error("Supabase URL is not stored in localStorage"); + } }; if (!homeWorkspace) {