mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-12 18:43:50 +00:00
Merge pull request #107 from jcreek/106-ensure-account-page-loads-when-there-are-no-transactions
fix(#106): Ensure account page loads when there are no transactions
This commit is contained in:
@@ -627,8 +627,8 @@ const getUserTransactions = async (
|
||||
.single();
|
||||
|
||||
if (error) {
|
||||
console.error('Error retrieving user data:', error.message);
|
||||
throw new Error('Failed to fetch user data');
|
||||
logger.error('Error retrieving user data:', error.message);
|
||||
return;
|
||||
}
|
||||
|
||||
const customerId = data?.stripe_customer_id;
|
||||
|
||||
@@ -23,9 +23,9 @@ export const load: PageServerLoad = async ({ locals: { supabase, safeGetSession
|
||||
|
||||
const transactionsData = await getUserTransactions(session.user.id, transactionsPerPage);
|
||||
|
||||
const transactions = transactionsData.transactions;
|
||||
const transactions = transactionsData?.transactions ?? [];
|
||||
const firstTransactionId = transactions.length > 0 ? transactions[0].id : undefined;
|
||||
const hasMoreThanOnePage = transactionsData.hasNextPage;
|
||||
const hasMoreThanOnePage = transactionsData?.hasNextPage ?? false;
|
||||
|
||||
return {
|
||||
session,
|
||||
|
||||
Reference in New Issue
Block a user