From 7e31323faa521e2f36f95ab252ec27e6f91f38ef Mon Sep 17 00:00:00 2001 From: Mythie Date: Mon, 20 Jan 2025 15:53:28 +1100 Subject: [PATCH] fix: add team context to more vanilla client usages --- .../documents/[id]/document-page-view-button.tsx | 13 ++++++++++--- .../documents/[id]/document-page-view-dropdown.tsx | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/apps/web/src/app/(dashboard)/documents/[id]/document-page-view-button.tsx b/apps/web/src/app/(dashboard)/documents/[id]/document-page-view-button.tsx index 2bc5e83b1..a477d75c6 100644 --- a/apps/web/src/app/(dashboard)/documents/[id]/document-page-view-button.tsx +++ b/apps/web/src/app/(dashboard)/documents/[id]/document-page-view-button.tsx @@ -46,9 +46,16 @@ export const DocumentPageViewButton = ({ document }: DocumentPageViewButtonProps const onDownloadClick = async () => { try { - const documentWithData = await trpcClient.document.getDocumentById.query({ - documentId: document.id, - }); + const documentWithData = await trpcClient.document.getDocumentById.query( + { + documentId: document.id, + }, + { + context: { + teamId: document.team?.id?.toString(), + }, + }, + ); const documentData = documentWithData?.documentData; diff --git a/apps/web/src/app/(dashboard)/documents/[id]/document-page-view-dropdown.tsx b/apps/web/src/app/(dashboard)/documents/[id]/document-page-view-dropdown.tsx index a4c79ec33..5075f342c 100644 --- a/apps/web/src/app/(dashboard)/documents/[id]/document-page-view-dropdown.tsx +++ b/apps/web/src/app/(dashboard)/documents/[id]/document-page-view-dropdown.tsx @@ -74,9 +74,16 @@ export const DocumentPageViewDropdown = ({ document, team }: DocumentPageViewDro const onDownloadClick = async () => { try { - const documentWithData = await trpcClient.document.getDocumentById.query({ - documentId: document.id, - }); + const documentWithData = await trpcClient.document.getDocumentById.query( + { + documentId: document.id, + }, + { + context: { + teamId: team?.id?.toString(), + }, + }, + ); const documentData = documentWithData?.documentData;