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) {