This commit is contained in:
parent
b771297b97
commit
7c07c19d16
|
|
@ -86,7 +86,7 @@ export default async function RootLayout({
|
|||
|
||||
const { t, resources } = await initTranslations(locale, i18nNamespaces)
|
||||
|
||||
console.log(".layout.tsx..............locale: ", {locale});
|
||||
console.log("layout.tsx..............locale: ", {locale});
|
||||
|
||||
return (
|
||||
<html lang="en" suppressHydrationWarning>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
"use client"
|
||||
|
||||
import { ChatbotUIContext } from "@/context/context"
|
||||
import { usePathname } from "next/navigation"
|
||||
|
||||
import { getProfileByUserId } from "@/db/profile"
|
||||
import { getWorkspaceImageFromStorage } from "@/db/storage/workspace-images"
|
||||
import { getWorkspacesByUserId } from "@/db/workspaces"
|
||||
|
|
@ -162,7 +164,11 @@ export const GlobalState: FC<GlobalStateProps> = ({ children }) => {
|
|||
setProfile(profile)
|
||||
|
||||
if (!profile.has_onboarded) {
|
||||
return router.push("/setup")
|
||||
// 提取当前路径中的 locale 部分
|
||||
const locale = pathname.split("/")[1] || "en" // 获取路径中的 locale 部分,如果没有则默认为 "en"
|
||||
|
||||
// 强制跳转到带有 locale 的 setup 页面
|
||||
return router.push(`/${locale}/setup`)
|
||||
}
|
||||
|
||||
const workspaces = await getWorkspacesByUserId(user.id)
|
||||
|
|
|
|||
Loading…
Reference in New Issue