Skip to content

Commit 6e4440e

Browse files
committed
redirect to marketplace page
1 parent 4f6a220 commit 6e4440e

5 files changed

Lines changed: 39 additions & 22 deletions

File tree

apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/apply/page.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@ export default async function ApplicationPage(props: {
2929
!program.group.applicationFormData ||
3030
!program.group.applicationFormPublishedAt
3131
) {
32-
// throw 404 if it's the default group, else redirect to the default group page
32+
// for the default group:
33+
// - if the program is found, redirect to the marketplace program page
34+
// - otherwise, throw 404
35+
// for other groups: redirect to the default group variant
3336
if (partnerGroupSlug === DEFAULT_PARTNER_GROUP.slug) {
37+
if (program) {
38+
redirect(`/marketplace/${programSlug}`);
39+
}
3440
notFound();
3541
} else {
3642
redirect(`/${programSlug}/apply`);

apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/apply/success/page.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,14 @@ export default async function SuccessPage(props: {
6565
!program.group.applicationFormData ||
6666
!program.group.applicationFormPublishedAt
6767
) {
68-
// throw 404 if it's the default group, else redirect to the default group page
68+
// for the default group:
69+
// - if the program is found, redirect to the marketplace program page
70+
// - otherwise, throw 404
71+
// for other groups: redirect to the default group variant
6972
if (partnerGroupSlug === DEFAULT_PARTNER_GROUP.slug) {
73+
if (program) {
74+
redirect(`/marketplace/${programSlug}`);
75+
}
7076
notFound();
7177
} else {
7278
redirect(`/${programSlug}/apply`);

apps/web/app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)/page.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ export default async function ApplyPage(props: {
2828
!program.group.landerData ||
2929
!program.group.landerPublishedAt
3030
) {
31-
// throw 404 if it's the default group, else redirect to the default group page
31+
// for the default group:
32+
// - if the program is found, redirect to the marketplace program page
33+
// - otherwise, throw 404
34+
// for other groups: redirect to the default group variant
3235
if (partnerGroupSlug === DEFAULT_PARTNER_GROUP.slug) {
36+
if (program) {
37+
redirect(`/marketplace/${programSlug}`);
38+
}
3339
notFound();
3440
} else {
3541
redirect(`/${programSlug}`);

apps/web/lib/fetchers/get-public-network-programs.ts

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,25 @@ export const getPublicNetworkPrograms = cache(
4949
},
5050
},
5151
}),
52-
groups: {
53-
some: {
54-
slug: DEFAULT_PARTNER_GROUP.slug,
55-
applicationFormPublishedAt: {
56-
not: null,
52+
...(rewardType && {
53+
groups: {
54+
some: {
55+
slug: DEFAULT_PARTNER_GROUP.slug,
56+
...(rewardType === "sale" && {
57+
saleRewardId: { not: null },
58+
}),
59+
...(rewardType === "lead" && {
60+
leadRewardId: { not: null },
61+
}),
62+
...(rewardType === "click" && {
63+
clickRewardId: { not: null },
64+
}),
65+
...(rewardType === "discount" && {
66+
discountId: { not: null },
67+
}),
5768
},
58-
...(rewardType === "sale" && {
59-
saleRewardId: { not: null },
60-
}),
61-
...(rewardType === "lead" && {
62-
leadRewardId: { not: null },
63-
}),
64-
...(rewardType === "click" && {
65-
clickRewardId: { not: null },
66-
}),
67-
...(rewardType === "discount" && {
68-
discountId: { not: null },
69-
}),
7069
},
71-
},
70+
}),
7271
},
7372
include: {
7473
groups: {

apps/web/ui/program-marketplace/external/marketplace-external-home-page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async function fetchHomePrograms(
1818

1919
export async function MarketplaceExternalHomePage() {
2020
const [featuredPrograms, ...rowPrograms] = await Promise.all([
21-
fetchHomePrograms({ featured: true, pageSize: 6 }),
21+
fetchHomePrograms({ featured: true }),
2222
...MARKETPLACE_HOME_ROWS.map((row) => fetchHomePrograms(row.fetchParams)),
2323
]);
2424

0 commit comments

Comments
 (0)