This commit is contained in:
hailin 2025-04-22 19:37:24 +08:00
parent d13fb6cc40
commit 6ae60f66cd
1 changed files with 21 additions and 15 deletions

View File

@ -38,17 +38,9 @@ export const DeleteWorkspace: FC<DeleteWorkspaceProps> = ({
const [name, setName] = useState("")
const handleDeleteWorkspace = async () => {
await deleteWorkspace(workspace.id)
setWorkspaces(prevWorkspaces => {
const filteredWorkspaces = prevWorkspaces.filter(
w => w.id !== workspace.id
)
const defaultWorkspace = filteredWorkspaces[0]
setSelectedWorkspace(defaultWorkspace)
const pathname = usePathname() // 获取当前路径
const pathSegments = pathname.split("/").filter(Boolean)
@ -66,6 +58,20 @@ export const DeleteWorkspace: FC<DeleteWorkspaceProps> = ({
const handleDeleteWorkspace = async () => {
await deleteWorkspace(workspace.id)
setWorkspaces(prevWorkspaces => {
const filteredWorkspaces = prevWorkspaces.filter(
w => w.id !== workspace.id
)
const defaultWorkspace = filteredWorkspaces[0]
setSelectedWorkspace(defaultWorkspace)
router.push(`${homePath}/${defaultWorkspace.id}/chat`)
// router.push(`/${defaultWorkspace.id}/chat`)