Skip to content

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

refactor: early return if teamId not present

Marc Seitz4822e7196d3c
diff --git a/pages/api/teams/[teamId]/domains/index.ts b/pages/api/teams/[teamId]/domains/index.ts
index f85f3e45..06c2def9 100644
--- a/pages/api/teams/[teamId]/domains/index.ts
+++ b/pages/api/teams/[teamId]/domains/index.ts
@@ -51,11 +51,12 @@ export default async function handle(
return;
}
- const { teamId } = req.query as { teamId: string };
-
const userId = (session.user as CustomUser).id;
+ const { teamId } = req.query as { teamId: string };
- // You could perform some validation here
+ if (!teamId) {
+ return res.status(401).json("Unauthorized");
+ }
try {
await getTeamWithDomain({