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.

remove has_more

Kiran K889aab391acc
diff --git a/apps/web/lib/tolt/api.ts b/apps/web/lib/tolt/api.ts
index 3c02e2fda7..8852c081d1 100644
--- a/apps/web/lib/tolt/api.ts
+++ b/apps/web/lib/tolt/api.ts
@@ -94,15 +94,11 @@ export class ToltApi {
searchParams.append("starting_after", startingAfter || "");
searchParams.append("limit", PAGE_LIMIT.toString());
- const { data, has_more, total_count } = await this.fetch<
- ToltListResponse<ToltAffiliate>
- >(`${this.baseUrl}/partners?${searchParams.toString()}`);
+ const { data } = await this.fetch<ToltListResponse<ToltAffiliate>>(
+ `${this.baseUrl}/partners?${searchParams.toString()}`,
+ );
- return {
- has_more,
- total_count,
- data: ToltAffiliateSchema.array().parse(data),
- };
+ return ToltAffiliateSchema.array().parse(data);
}
async listLinks({
@@ -118,15 +114,11 @@ export class ToltApi {
searchParams.append("starting_after", startingAfter || "");
searchParams.append("limit", PAGE_LIMIT.toString());
- const { data, has_more, total_count } = await this.fetch<
- ToltListResponse<ToltLink>
- >(`${this.baseUrl}/links?${searchParams.toString()}`);
+ const { data } = await this.fetch<ToltListResponse<ToltLink>>(
+ `${this.baseUrl}/links?${searchParams.toString()}`,
+ );
- return {
- has_more,
- total_count,
- data: ToltLinkSchema.array().parse(data),
- };
+ return ToltLinkSchema.array().parse(data);
}
async listCustomers({
diff --git a/apps/web/lib/tolt/import-affiliates.ts b/apps/web/lib/tolt/import-affiliates.ts
index ae7017b8a2..5bbadaafce 100644
--- a/apps/web/lib/tolt/import-affiliates.ts
+++ b/apps/web/lib/tolt/import-affiliates.ts
@@ -37,14 +37,13 @@ export async function importAffiliates({
const reward = saleReward || leadReward || clickReward;
while (hasMore && processedBatches < MAX_BATCHES) {
- const { data: affiliates, has_more } = await toltApi.listAffiliates({
+ const affiliates = await toltApi.listAffiliates({
programId: toltProgramId,
startingAfter,
});
- hasMore = has_more;
-
if (affiliates.length === 0) {
+ hasMore = false;
console.log("No more affiliates to import.");
break;
}
diff --git a/apps/web/lib/tolt/import-links.ts b/apps/web/lib/tolt/import-links.ts
index 65a4605837..0463702a25 100644
--- a/apps/web/lib/tolt/import-links.ts
+++ b/apps/web/lib/tolt/import-links.ts
@@ -27,14 +27,13 @@ export async function importLinks({
let processedBatches = 0;
while (hasMore && processedBatches < MAX_BATCHES) {
- const { data: links, has_more } = await toltApi.listLinks({
+ const links = await toltApi.listLinks({
programId: toltProgramId,
startingAfter,
});
- hasMore = has_more;
-
if (links.length === 0) {
+ hasMore = false;
console.log("No more links to import.");
break;
}
diff --git a/apps/web/lib/tolt/types.ts b/apps/web/lib/tolt/types.ts
index c71366bb74..6eb588a58c 100644
--- a/apps/web/lib/tolt/types.ts
+++ b/apps/web/lib/tolt/types.ts
@@ -15,7 +15,6 @@ export interface ToltConfig {
export interface ToltListResponse<T> {
success: true;
- has_more: boolean;
total_count: number;
data: T[];
}
@@ -24,18 +23,10 @@ export interface ToltProgram extends z.infer<typeof ToltProgramSchema> {
total_affiliates: number;
}
-export interface ToltAffiliate extends z.infer<typeof ToltAffiliateSchema> {
- //
-}
+export type ToltAffiliate = z.infer<typeof ToltAffiliateSchema>;
-export interface ToltLink extends z.infer<typeof ToltLinkSchema> {
- //
-}
+export type ToltLink = z.infer<typeof ToltLinkSchema>;
-export interface ToltCustomer extends z.infer<typeof ToltCustomerSchema> {
- //
-}
+export type ToltCustomer = z.infer<typeof ToltCustomerSchema>;
-export interface ToltCommission extends z.infer<typeof ToltCommissionSchema> {
- //
-}
+export type ToltCommission = z.infer<typeof ToltCommissionSchema>;