Skip to content

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

refactor: adapt document version to team

Marc Seitz5a1d7a3c3fce
diff --git a/components/documents/add-document-modal.tsx b/components/documents/add-document-modal.tsx
index 9ed61543..0af6f7db 100644
--- a/components/documents/add-document-modal.tsx
+++ b/components/documents/add-document-modal.tsx
@@ -131,17 +131,20 @@ export function AddDocumentModal({newVersion, children}: {newVersion?: boolean,
// create a new version in the database
async function saveNewVersionToDatabase(blob: PutBlobResult, documentId: string, numPages?: number) {
- const response = await fetch(`/api/documents/${documentId}/versions`, {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({
- url: blob.url,
- numPages: numPages,
- type: "pdf",
- }),
- });
+ const response = await fetch(
+ `/api/teams/${teamInfo?.currentTeam?.id}/documents/${documentId}/versions`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ url: blob.url,
+ numPages: numPages,
+ type: "pdf",
+ }),
+ }
+ );
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);