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.

wip

Kiran K4a50cfb19089
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/payouts/payout-list.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/payouts/payout-list.tsx
index f301adf0f3..ba67906f33 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/payouts/payout-list.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/[programId]/payouts/payout-list.tsx
@@ -1,3 +1,16 @@
+import { PayoutProps } from "@/lib/types";
+import { fetcher } from "@dub/utils/src/functions/fetcher";
+import useSWR from "swr";
+
export function PayoutList({ programId }: { programId: string }) {
+ // use SWR to fetch the payouts from /program/id/ payouts
+
+ const { data, error, isLoading } = useSWR<PayoutProps[]>(
+ `/api/program/${programId}/payouts`,
+ fetcher,
+ );
+
+ console.log({ data, error, isLoading });
+
return <div>Payout list</div>;
}
diff --git a/apps/web/lib/types.ts b/apps/web/lib/types.ts
index e1cdafb694..90fb078efe 100644
--- a/apps/web/lib/types.ts
+++ b/apps/web/lib/types.ts
@@ -10,6 +10,7 @@ import { createLinkBodySchema } from "./zod/schemas/links";
import { createOAuthAppSchema, oAuthAppSchema } from "./zod/schemas/oauth";
import {
PartnerSchema,
+ PayoutSchema,
ProgramEnrollmentSchema,
ProgramSchema,
} from "./zod/schemas/partners";
@@ -282,3 +283,5 @@ export type PartnerProps = z.infer<typeof PartnerSchema>;
export type ProgramProps = z.infer<typeof ProgramSchema>;
export type ProgramEnrollmentProps = z.infer<typeof ProgramEnrollmentSchema>;
+
+export type PayoutProps = z.infer<typeof PayoutSchema>;