Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: delete documents inside folders

Marc Seitz4f6765ea4945
diff --git a/components/documents/document-card.tsx b/components/documents/document-card.tsx
index 0e18c25f..f2d4f3ad 100644
--- a/components/documents/document-card.tsx
+++ b/components/documents/document-card.tsx
@@ -102,11 +102,15 @@ export default function DocumentsCard({
return;
}
+ const endpoint = currentFolderPath
+ ? `/folders/documents/${currentFolderPath.join("/")}`
+ : "/documents";
+
toast.promise(
fetch(`/api/teams/${teamInfo?.currentTeam?.id}/documents/${documentId}`, {
method: "DELETE",
}).then(() => {
- mutate(`/api/teams/${teamInfo?.currentTeam?.id}/documents`, null, {
+ mutate(`/api/teams/${teamInfo?.currentTeam?.id}${endpoint}`, null, {
populateCache: (_, docs) => {
return docs.filter(
(doc: DocumentWithLinksAndLinkCountAndViewCount) =>