From 32874e0d1575ef18b8b597018b6dd79b58838da6 Mon Sep 17 00:00:00 2001 From: hailin Date: Wed, 25 Jun 2025 18:28:57 +0800 Subject: [PATCH] . --- chatdesk-ui/app/[locale]/layout.tsx | 38 +---------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/chatdesk-ui/app/[locale]/layout.tsx b/chatdesk-ui/app/[locale]/layout.tsx index b45e823..3479d73 100644 --- a/chatdesk-ui/app/[locale]/layout.tsx +++ b/chatdesk-ui/app/[locale]/layout.tsx @@ -3,14 +3,12 @@ import { GlobalState } from "@/components/utility/global-state" import { Providers } from "@/components/utility/providers" import TranslationsProvider from "@/components/utility/translations-provider" import initTranslations from "@/lib/i18n" -//import { Database } from "@/supabase/types" import { getSupabaseServerClient } from "@/lib/supabase/server" import { Metadata, Viewport } from "next" import { Inter } from "next/font/google" import { cookies } from "next/headers" import { ReactNode } from "react" import "./globals.css" -//import Script from "next/script" import { Suspense } from "react" import { RuntimeEnvProvider } from "@/components/utility/runtime-env-provider" @@ -28,26 +26,6 @@ interface RootLayoutProps { } } - - -// 新增的 `getValidSupabaseUrl` 函数,带有超时机制和错误处理 -// async function getValidSupabaseUrl(): Promise { -// let url = getRuntimeEnv("SUPABASE_URL"); -// const timeout = Date.now() + 30000; // 设置最大等待时间为30秒 - -// while (!url || !url.includes(":")) { // 检查是否包含合法的 IP 和端口 -// if (Date.now() > timeout) { -// throw new Error("获取有效的 Supabase URL 超时"); -// } -// console.log("等待有效的 Supabase URL..."); -// await new Promise(resolve => setTimeout(resolve, 1000)); // 每1秒检查一次 -// url = getRuntimeEnv("SUPABASE_URL"); -// } -// return url; -// } - - - export async function generateMetadata({ params: { locale } }: { @@ -113,16 +91,6 @@ export default async function RootLayout({ console.log(`🍪 Cookie: ${cookie.name} = ${cookie.value}`); } - // let supabaseUrl = ""; - // try { - // // 等待直到获取到有效的 Supabase URL - // supabaseUrl = await getValidSupabaseUrl(); - // //console.log("==========>获取到有效的 Supabase URL: ", supabaseUrl); - // } catch (error) { - // console.error("Supabase URL 获取失败:", error); - // return
Failed to fetch Supabase configuration, please try again later.
; // 出现错误时返回一个友好的提示 - // } - const supabase = getSupabaseServerClient() const { data, error } = await supabase.auth.getSession(); if (error) { @@ -137,11 +105,7 @@ export default async function RootLayout({ - {/*