The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
account for null promoter_campaign in fp.listCustomers
Steven Teyb98c2f454112
diff --git a/apps/web/lib/firstpromoter/api.ts b/apps/web/lib/firstpromoter/api.tsindex 7b45b22342..1ae543171f 100644--- a/apps/web/lib/firstpromoter/api.ts+++ b/apps/web/lib/firstpromoter/api.ts@@ -87,9 +87,16 @@ export class FirstPromoterApi {...(page ? { page: page.toString() } : {}),});- const customers = await this.fetch(`/referrals?${searchParams.toString()}`);+ const customers = (await this.fetch(+ `/referrals?${searchParams.toString()}`,+ )) as any[];- return firstPromoterCustomerSchema.array().parse(customers);+ // filter out the customers without an associated promoter+ const filteredCustomers = customers.filter(+ ({ promoter_campaign }) => promoter_campaign?.promoter,+ );++ return firstPromoterCustomerSchema.array().parse(filteredCustomers);}async listCommissions({ page }: { page?: number }) {