mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-28 05:03:33 +00:00
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
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 7m2s
This commit is contained in:
@ -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: {
|
||||
|
@ -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")) {
|
||||
|
Reference in New Issue
Block a user