From aedf7cdf7ddaf90656068c715d1bde5aa2c6e2fa Mon Sep 17 00:00:00 2001 From: i701 Date: Fri, 25 Jul 2025 11:06:55 +0500 Subject: [PATCH] =?UTF-8?q?feat(topups):=20add=20support=20for=20fetching?= =?UTF-8?q?=20all=20topups=20in=20getTopups=20function=20=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- actions/payment.ts | 4 ++-- components/admin/admin-topup-table.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/actions/payment.ts b/actions/payment.ts index 1a35f27..6637c24 100644 --- a/actions/payment.ts +++ b/actions/payment.ts @@ -122,7 +122,7 @@ export async function getPayments(params: GetPaymentProps, allPayments = false) return data; } -export async function getTopups(params: GenericGetResponseProps) { +export async function getTopups(params: GenericGetResponseProps, all_topups = false) { // Build query string from all defined params const query = Object.entries(params) @@ -132,7 +132,7 @@ export async function getTopups(params: GenericGetResponseProps) { const session = await getServerSession(authOptions); const response = await fetch( - `${process.env.SARLINK_API_BASE_URL}/api/billing/topup/?${query}`, + `${process.env.SARLINK_API_BASE_URL}/api/billing/topup/?${query}&all_topups=${all_topups}`, { method: "GET", headers: { diff --git a/components/admin/admin-topup-table.tsx b/components/admin/admin-topup-table.tsx index c34b401..0b138f6 100644 --- a/components/admin/admin-topup-table.tsx +++ b/components/admin/admin-topup-table.tsx @@ -39,7 +39,7 @@ export async function AdminTopupsTable({ } apiParams.limit = limit; apiParams.offset = offset; - const [error, topups] = await tryCatch(getTopups(apiParams,)); + const [error, topups] = await tryCatch(getTopups(apiParams, true)); if (error) { if (error.message.includes("Unauthorized")) {