Skip to content

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

fix: type error

Marc Seitz90cc74317ec5
diff --git a/pages/api/jobs/send-dataroom-new-document-notification.ts b/pages/api/jobs/send-dataroom-new-document-notification.ts
index d7c5eeaa..3f5228e8 100644
--- a/pages/api/jobs/send-dataroom-new-document-notification.ts
+++ b/pages/api/jobs/send-dataroom-new-document-notification.ts
@@ -37,14 +37,14 @@ export default async function handle(
senderUserId: string;
};
- let viewer: { email: string; dataroom: { name: string } } | null = null;
+ let viewer: { email: string; dataroom: { name: string } | null } | null =
+ null;
try {
// Fetch the link to verify the settings
viewer = await prisma.viewer.findUnique({
where: {
id: viewerId,
- dataroomId: dataroomId,
},
select: {
email: true,
@@ -98,7 +98,7 @@ export default async function handle(
}
await sendDataroomNotification({
- dataroomName: viewer.dataroom.name,
+ dataroomName: viewer.dataroom?.name ?? "",
senderEmail: user.email!,
documentName: document?.document.name,
to: viewer.email,
diff --git a/pages/api/jobs/send-dataroom-view-invitation.ts b/pages/api/jobs/send-dataroom-view-invitation.ts
index 2b9305e2..63bfc98f 100644
--- a/pages/api/jobs/send-dataroom-view-invitation.ts
+++ b/pages/api/jobs/send-dataroom-view-invitation.ts
@@ -35,7 +35,8 @@ export default async function handle(
senderUserId: string;
};
- let viewer: { email: string; dataroom: { name: string } } | null = null;
+ let viewer: { email: string; dataroom: { name: string } | null } | null =
+ null;
try {
// Fetch the link to verify the settings
@@ -81,7 +82,7 @@ export default async function handle(
// send email to document owner that document
await sendDataroomViewerInvite({
- dataroomName: viewer.dataroom.name,
+ dataroomName: viewer.dataroom?.name ?? "",
senderEmail: user.email!,
to: viewer.email,
url: `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${linkId}?email=${encodeURIComponent(viewer.email)}`,