This commit is contained in:
parent
d13fb6cc40
commit
6ae60f66cd
|
|
@ -38,6 +38,27 @@ export const DeleteWorkspace: FC<DeleteWorkspaceProps> = ({
|
||||||
|
|
||||||
const [name, setName] = useState("")
|
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 () => {
|
const handleDeleteWorkspace = async () => {
|
||||||
await deleteWorkspace(workspace.id)
|
await deleteWorkspace(workspace.id)
|
||||||
|
|
||||||
|
|
@ -50,21 +71,6 @@ export const DeleteWorkspace: FC<DeleteWorkspaceProps> = ({
|
||||||
|
|
||||||
setSelectedWorkspace(defaultWorkspace)
|
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(`${homePath}/${defaultWorkspace.id}/chat`)
|
||||||
// router.push(`/${defaultWorkspace.id}/chat`)
|
// router.push(`/${defaultWorkspace.id}/chat`)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue