This commit is contained in:
parent
d13fb6cc40
commit
6ae60f66cd
|
|
@ -38,17 +38,9 @@ export const DeleteWorkspace: FC<DeleteWorkspaceProps> = ({
|
||||||
|
|
||||||
const [name, setName] = useState("")
|
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 pathname = usePathname() // 获取当前路径
|
||||||
const pathSegments = pathname.split("/").filter(Boolean)
|
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(`${homePath}/${defaultWorkspace.id}/chat`)
|
||||||
// router.push(`/${defaultWorkspace.id}/chat`)
|
// router.push(`/${defaultWorkspace.id}/chat`)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue