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)
|
const { t, resources } = await initTranslations(locale, i18nNamespaces)
|
||||||
|
|
||||||
console.log(".layout.tsx..............locale: ", {locale});
|
console.log("layout.tsx..............locale: ", {locale});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html lang="en" suppressHydrationWarning>
|
<html lang="en" suppressHydrationWarning>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { ChatbotUIContext } from "@/context/context"
|
import { ChatbotUIContext } from "@/context/context"
|
||||||
|
import { usePathname } from "next/navigation"
|
||||||
|
|
||||||
import { getProfileByUserId } from "@/db/profile"
|
import { getProfileByUserId } from "@/db/profile"
|
||||||
import { getWorkspaceImageFromStorage } from "@/db/storage/workspace-images"
|
import { getWorkspaceImageFromStorage } from "@/db/storage/workspace-images"
|
||||||
import { getWorkspacesByUserId } from "@/db/workspaces"
|
import { getWorkspacesByUserId } from "@/db/workspaces"
|
||||||
|
|
@ -162,7 +164,11 @@ export const GlobalState: FC<GlobalStateProps> = ({ children }) => {
|
||||||
setProfile(profile)
|
setProfile(profile)
|
||||||
|
|
||||||
if (!profile.has_onboarded) {
|
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)
|
const workspaces = await getWorkspacesByUserId(user.id)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue