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.

finalize reward sheet

Steven Teyc1b533eae1c0
diff --git a/apps/web/lib/partners/create-partner-commission.ts b/apps/web/lib/partners/create-partner-commission.ts
index 6dffb49ece..66e70e07aa 100644
--- a/apps/web/lib/partners/create-partner-commission.ts
+++ b/apps/web/lib/partners/create-partner-commission.ts
@@ -129,7 +129,7 @@ export const createPartnerCommission = async ({
}
// for reward types with a max duration, we need to check if the first commission is within the max duration
- // if its beyond the max duration, we should not create a new commission
+ // if it's beyond the max duration, we should not create a new commission
if (typeof reward?.maxDuration === "number") {
// One-time sale reward (maxDuration === 0)
if (reward.maxDuration === 0) {
diff --git a/apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx b/apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx
index 558b367ded..794e63187a 100644
--- a/apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx
+++ b/apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx
@@ -84,6 +84,7 @@ function RewardSheetContent({
const { id: workspaceId, defaultProgramId, plan } = useWorkspace();
const formRef = useRef<HTMLFormElement>(null);
const { mutate: mutateProgram } = useProgram();
+ const { queryParams } = useRouterStuff();
const defaultValuesSource = reward || defaultRewardValues;
@@ -138,7 +139,7 @@ function RewardSheetContent({
updateRewardAction,
{
onSuccess: async () => {
- setIsOpen(false);
+ queryParams({ del: "rewardId", scroll: false });
toast.success("Reward updated!");
await mutateProgram();
await mutateGroup();
@@ -336,7 +337,7 @@ function RewardSheetContent({
value: "0",
},
...RECURRING_MAX_DURATIONS.filter(
- (v) => v !== 0,
+ (v) => v !== 0 && v !== 1,
).map((v) => ({
text: `for ${v} ${pluralize("month", Number(v))}`,
value: v.toString(),