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.

account for null referral.id

Steven Tey4f8eed073986
diff --git a/apps/web/lib/rewardful/api.ts b/apps/web/lib/rewardful/api.ts
index e919b3cd36..eebcdd2091 100644
--- a/apps/web/lib/rewardful/api.ts
+++ b/apps/web/lib/rewardful/api.ts
@@ -74,11 +74,14 @@ export class RewardfulApi {
searchParams.append("page", page.toString());
searchParams.append("limit", REWARDFUL_PAGE_LIMIT.toString());
- const { data } = await this.fetch<{ data: RewardfulReferral[] }>(
- `${this.baseUrl}/referrals?${searchParams.toString()}`,
- );
+ const { data } = await this.fetch<{
+ data: Omit<RewardfulReferral, "id"> & { id: string | null }[];
+ }>(`${this.baseUrl}/referrals?${searchParams.toString()}`);
- return data;
+ // for some reason the id can be null, so we need to filter out those referrals before returning the data
+ const filteredData = data.filter((referral) => referral.id !== null);
+
+ return filteredData as RewardfulReferral[];
}
async listCommissions({ page = 1 }: { page?: number }) {