Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update invite-partner.ts

Steven Tey4294afecc100
diff --git a/apps/web/lib/actions/invite-partner.ts b/apps/web/lib/actions/invite-partner.ts
index fac3ca65d7..3aef5285a8 100644
--- a/apps/web/lib/actions/invite-partner.ts
+++ b/apps/web/lib/actions/invite-partner.ts
@@ -46,6 +46,10 @@ export const invitePartnerAction = authActionClient
}),
]);
+ if (link.programId) {
+ throw new Error("Link is already associated with another partner.");
+ }
+
const [programEnrollment, programInvite] = await Promise.all([
prisma.programEnrollment.findFirst({
where: {
@@ -80,10 +84,6 @@ export const invitePartnerAction = authActionClient
throw new Error(`Partner ${email} already invited to this program.`);
}
- if (link.programId) {
- throw new Error("Link is already associated with another partner.");
- }
-
const [result, _] = await Promise.all([
prisma.programInvite.create({
data: {