diff --git a/app/(dashboard)/top-ups/[topupId]/page.tsx b/app/(dashboard)/top-ups/[topupId]/page.tsx index c981875..a36e23f 100644 --- a/app/(dashboard)/top-ups/[topupId]/page.tsx +++ b/app/(dashboard)/top-ups/[topupId]/page.tsx @@ -25,20 +25,19 @@ export default async function TopupPage({

Topup

- {!topup.is_expired || - (topup.status !== "PENDING" && ( - - ))} + {!topup.is_expired && topup.paid && topup.status !== "PENDING" && ( + + )} {topup.status === "PENDING" && !topup.is_expired && (
- { - (!topup.paid && topup.status === "PENDING" && !topup.is_expired) && ( - - ) - } + {!topup.paid && topup.status === "PENDING" && !topup.is_expired && ( + + )}
- + ); } diff --git a/components/devices-table.tsx b/components/devices-table.tsx index 9c82bce..85ddcdf 100644 --- a/components/devices-table.tsx +++ b/components/devices-table.tsx @@ -52,7 +52,6 @@ export async function DevicesTable({ } apiParams.limit = limit; apiParams.offset = offset; - console.log("API Params:", apiParams); const [error, devices] = await tryCatch( getDevices(apiParams), ); diff --git a/components/payments-table.tsx b/components/payments-table.tsx index 4b79ec5..c85cc7b 100644 --- a/components/payments-table.tsx +++ b/components/payments-table.tsx @@ -28,12 +28,17 @@ export async function PaymentsTable({ }>; }) { const resolvedParams = await searchParams; + const page = Number.parseInt(resolvedParams.page as string) || 1; + const limit = 10; + const offset = (page - 1) * limit; const apiParams: Record = {}; for (const [key, value] of Object.entries(resolvedParams)) { if (value !== undefined && value !== "") { apiParams[key] = typeof value === "number" ? value : String(value); } } + apiParams.limit = limit; + apiParams.offset = offset; const [error, payments] = await tryCatch(getPayments(apiParams)); if (error) { @@ -166,7 +171,7 @@ export async function PaymentsTable({ diff --git a/components/topups-table.tsx b/components/topups-table.tsx index f85e3eb..a312f3e 100644 --- a/components/topups-table.tsx +++ b/components/topups-table.tsx @@ -27,7 +27,9 @@ export async function TopupsTable({ }>; }) { const resolvedParams = await searchParams; - + const page = Number.parseInt(resolvedParams.page as string) || 1; + const limit = 10; + const offset = (page - 1) * limit; // Build params object const apiParams: Record = {}; for (const [key, value] of Object.entries(resolvedParams)) { @@ -35,7 +37,8 @@ export async function TopupsTable({ apiParams[key] = typeof value === "number" ? value : String(value); } } - + apiParams.limit = limit; + apiParams.offset = offset; const [error, topups] = await tryCatch(getTopups(apiParams)); if (error) { @@ -151,8 +154,8 @@ export async function TopupsTable({ ))} )}