feat(#76): Ensure pagination is only possible for valid pages

This commit is contained in:
Josh Creek
2024-11-12 20:09:01 +00:00
parent c77dc6ac47
commit 5de84d2ec1
3 changed files with 81 additions and 56 deletions
+3 -1
View File
@@ -625,6 +625,8 @@ const getUserTransactions = async (
const charges = await stripeClient.charges.list(params);
const hasNextPage = charges.has_more;
// Step 3: Format transaction data
const transactions = charges.data.map((charge) => ({
id: charge.id,
@@ -640,7 +642,7 @@ const getUserTransactions = async (
receipt_url: charge.receipt_url
}));
return transactions;
return { transactions, hasNextPage };
} catch (error) {
console.error('An error occurred while retrieving transactions:', error);
throw new Error('Could not retrieve transactions');