feat(topups): add support for fetching all topups in getTopups function
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 7m2s

This commit is contained in:
2025-07-25 11:06:55 +05:00
parent a2425009ee
commit aedf7cdf7d
2 changed files with 3 additions and 3 deletions

View File

@ -122,7 +122,7 @@ export async function getPayments(params: GetPaymentProps, allPayments = false)
return data; return data;
} }
export async function getTopups(params: GenericGetResponseProps) { export async function getTopups(params: GenericGetResponseProps, all_topups = false) {
// Build query string from all defined params // Build query string from all defined params
const query = Object.entries(params) const query = Object.entries(params)
@ -132,7 +132,7 @@ export async function getTopups(params: GenericGetResponseProps) {
const session = await getServerSession(authOptions); const session = await getServerSession(authOptions);
const response = await fetch( 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", method: "GET",
headers: { headers: {

View File

@ -39,7 +39,7 @@ export async function AdminTopupsTable({
} }
apiParams.limit = limit; apiParams.limit = limit;
apiParams.offset = offset; apiParams.offset = offset;
const [error, topups] = await tryCatch(getTopups(apiParams,)); const [error, topups] = await tryCatch(getTopups(apiParams, true));
if (error) { if (error) {
if (error.message.includes("Unauthorized")) { if (error.message.includes("Unauthorized")) {