This commit is contained in:
hailin 2025-05-20 22:08:31 +08:00
parent 2a611cf853
commit 9c9e2ef8d9
2 changed files with 4 additions and 36 deletions

View File

@ -186,15 +186,14 @@ export const GlobalState: FC<GlobalStateProps> = ({ 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)

View File

@ -10,34 +10,3 @@ export const supabase = createBrowserClient<Database>(
// import { createBrowserClient } from "@supabase/ssr"
// import { Database } from "@/supabase/types"
// let _supabase: ReturnType<typeof createBrowserClient<Database>> | 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<string> {
// 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")
// }