mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-15 03:53:48 +00:00
fix(#106): Ensure account page loads when there are no transactions
This commit is contained in:
@@ -627,8 +627,8 @@ const getUserTransactions = async (
|
|||||||
.single();
|
.single();
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error('Error retrieving user data:', error.message);
|
logger.error('Error retrieving user data:', error.message);
|
||||||
throw new Error('Failed to fetch user data');
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const customerId = data?.stripe_customer_id;
|
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 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 firstTransactionId = transactions.length > 0 ? transactions[0].id : undefined;
|
||||||
const hasMoreThanOnePage = transactionsData.hasNextPage;
|
const hasMoreThanOnePage = transactionsData?.hasNextPage ?? false;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
session,
|
session,
|
||||||
|
|||||||
Reference in New Issue
Block a user