Skip to content

Commit f686740

Browse files
committed
fix inAppApplication condition
1 parent b81b3b3 commit f686740

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

apps/web/lib/actions/partners/create-program-application.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -179,26 +179,28 @@ export const createProgramApplicationAction = actionClient
179179
throw new Error("This program is no longer accepting applications.");
180180
}
181181

182-
// for in-app applications from existing partners, we need to check
183-
// if the partner has an incomplete profile, if so we prompt them to complete it
184-
if (inAppApplication && existingPartner) {
185-
const { isComplete } = getPartnerProfileChecklistProgress({
186-
partner: {
187-
...existingPartner,
188-
preferredEarningStructures:
189-
existingPartner.preferredEarningStructures.map(
190-
({ preferredEarningStructure }) => preferredEarningStructure,
182+
if (existingPartner) {
183+
// for in-app applications from existing partners, we need to check
184+
// if the partner has an incomplete profile, if so we prompt them to complete it
185+
if (inAppApplication) {
186+
const { isComplete } = getPartnerProfileChecklistProgress({
187+
partner: {
188+
...existingPartner,
189+
preferredEarningStructures:
190+
existingPartner.preferredEarningStructures.map(
191+
({ preferredEarningStructure }) => preferredEarningStructure,
192+
),
193+
salesChannels: existingPartner.salesChannels.map(
194+
({ salesChannel }) => salesChannel,
191195
),
192-
salesChannels: existingPartner.salesChannels.map(
193-
({ salesChannel }) => salesChannel,
194-
),
195-
},
196-
});
196+
},
197+
});
197198

198-
if (!isComplete) {
199-
throw new Error(
200-
"Please complete your partner profile to submit your application: https://partners.dub.co/profile",
201-
);
199+
if (!isComplete) {
200+
throw new Error(
201+
"Please complete your partner profile to submit your application: https://partners.dub.co/profile",
202+
);
203+
}
202204
}
203205

204206
return createApplicationAndEnrollment({

0 commit comments

Comments
 (0)