From 6ae60f66cddb652bd5139c7117685924d54929f6 Mon Sep 17 00:00:00 2001 From: hailin Date: Tue, 22 Apr 2025 19:37:24 +0800 Subject: [PATCH] . --- components/workspace/delete-workspace.tsx | 36 +++++++++++++---------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/components/workspace/delete-workspace.tsx b/components/workspace/delete-workspace.tsx index 5e3c134..82117bf 100644 --- a/components/workspace/delete-workspace.tsx +++ b/components/workspace/delete-workspace.tsx @@ -38,6 +38,27 @@ export const DeleteWorkspace: FC = ({ const [name, setName] = useState("") + + + + + const pathname = usePathname() // 获取当前路径 + const pathSegments = pathname.split("/").filter(Boolean) + const locales = i18nConfig.locales + const defaultLocale = i18nConfig.defaultLocale + + let locale: (typeof locales)[number] = defaultLocale + + const segment = pathSegments[0] as (typeof locales)[number] + + if (locales.includes(segment)) { + locale = segment + } + const homePath = locale === defaultLocale ? "/" : `/${locale}` + + + + const handleDeleteWorkspace = async () => { await deleteWorkspace(workspace.id) @@ -50,21 +71,6 @@ export const DeleteWorkspace: FC = ({ setSelectedWorkspace(defaultWorkspace) - const pathname = usePathname() // 获取当前路径 - const pathSegments = pathname.split("/").filter(Boolean) - const locales = i18nConfig.locales - const defaultLocale = i18nConfig.defaultLocale - - let locale: (typeof locales)[number] = defaultLocale - - const segment = pathSegments[0] as (typeof locales)[number] - - if (locales.includes(segment)) { - locale = segment - } - const homePath = locale === defaultLocale ? "/" : `/${locale}` - - router.push(`${homePath}/${defaultWorkspace.id}/chat`) // router.push(`/${defaultWorkspace.id}/chat`)