From 9c9e2ef8d902b36f49eb037573f1785202631f46 Mon Sep 17 00:00:00 2001 From: hailin Date: Tue, 20 May 2025 22:08:31 +0800 Subject: [PATCH] . --- .../components/utility/global-state.tsx | 9 +++--- chatdesk-ui/lib/supabase/browser-client.ts | 31 ------------------- 2 files changed, 4 insertions(+), 36 deletions(-) diff --git a/chatdesk-ui/components/utility/global-state.tsx b/chatdesk-ui/components/utility/global-state.tsx index a89b3fe..316758f 100644 --- a/chatdesk-ui/components/utility/global-state.tsx +++ b/chatdesk-ui/components/utility/global-state.tsx @@ -186,15 +186,14 @@ export const GlobalState: FC = ({ children }) => { const profile = await getProfileByUserId(user.id) setProfile(profile) - if (!profile.has_onboarded) { + if (profile !== null && profile !== undefined && !profile.has_onboarded) { // 修正 homePath 拼接逻辑,避免 //setup 问题 const homePath = locale === defaultLocale ? "" : `/${locale}` - const targetPath = `${homePath}/setup` + //const targetPath = `${homePath}/setup` + const targetPath = `${homePath}/setup`.replace(/\/\//g, '/') + - // console.log("[global-state.tsx]-------------", targetPath) router.push(targetPath) - // return router.push(`${homePath}/setup`) - // return router.push(`/${locale}/setup`) } const workspaces = await getWorkspacesByUserId(user.id) diff --git a/chatdesk-ui/lib/supabase/browser-client.ts b/chatdesk-ui/lib/supabase/browser-client.ts index 05cffc1..0d0aaf7 100644 --- a/chatdesk-ui/lib/supabase/browser-client.ts +++ b/chatdesk-ui/lib/supabase/browser-client.ts @@ -10,34 +10,3 @@ export const supabase = createBrowserClient( -// import { createBrowserClient } from "@supabase/ssr" -// import { Database } from "@/supabase/types" - -// let _supabase: ReturnType> | null = null - -// export async function createClient() { -// if (_supabase) return _supabase - -// const url = await getRuntimeSupabaseUrl() -// const key = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! // 你要求写死,保留 - -// _supabase = createBrowserClient(url, key) -// return _supabase -// } - -// // Export the supabase client directly for easier usage -// export const supabase = async () => { -// // Simply return the client created by createClient -// return await createClient() -// } - -// async function getRuntimeSupabaseUrl(retry = 30, interval = 50): Promise { -// for (let i = 0; i < retry; i++) { -// const url = window?.RUNTIME_ENV?.SUPABASE_URL -// if (url) return url -// await new Promise((r) => setTimeout(r, interval)) -// } -// throw new Error("RUNTIME_ENV.SUPABASE_URL not ready") -// } - -