diff --git a/components/documents/actions/delete-documents-modal.tsx b/components/documents/actions/delete-documents-modal.tsx index 4872aaa80..d16ab8cf2 100644 --- a/components/documents/actions/delete-documents-modal.tsx +++ b/components/documents/actions/delete-documents-modal.tsx @@ -12,13 +12,13 @@ import { useTeam } from "@/context/team-context"; import { toast } from "sonner"; import { mutate } from "swr"; +import { useAnalytics } from "@/lib/analytics"; + import { Button } from "@/components/ui/button"; import { DialogDescription, DialogTitle } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { Modal } from "@/components/ui/modal"; -import { useAnalytics } from "@/lib/analytics"; - function DeleteItemsModal({ showDeleteItemsModal, setShowDeleteItemsModal, @@ -51,9 +51,6 @@ function DeleteItemsModal({ setIsValid(false); } }; - const parentFolderPath = folderPathName - ?.join("/") - ?.substring(0, folderPathName?.lastIndexOf("/")); async function deleteDocumentsAndFolders( documentIds: string[], @@ -135,11 +132,12 @@ function DeleteItemsModal({ `/api/teams/${teamInfo?.currentTeam?.id}/folders?root=true`, ); await mutate(`/api/teams/${teamInfo?.currentTeam?.id}/folders`); - await mutate( - `/api/teams/${teamInfo?.currentTeam?.id}/folders${parentFolderPath}`, - ); - if (folderPathName && folderPathName.length > 0) { + await mutate( + `/api/teams/${ + teamInfo?.currentTeam?.id + }/folders/${folderPathName.join("/")}`, + ); await mutate( `/api/teams/${ teamInfo?.currentTeam?.id