Add error handling to accounts/ledger page
This commit is contained in:
@@ -33,7 +33,11 @@ export default async function AccountsPage({
|
||||
// Include the whole "to" day, not just its midnight.
|
||||
const to = searchParams.to ? new Date(`${searchParams.to}T23:59:59`) : null;
|
||||
|
||||
const [orders, manualSales] = await Promise.all([
|
||||
let orders = [];
|
||||
let manualSales = [];
|
||||
|
||||
try {
|
||||
[orders, manualSales] = await Promise.all([
|
||||
type === 'manual'
|
||||
? []
|
||||
: prisma.order.findMany({
|
||||
@@ -50,6 +54,9 @@ export default async function AccountsPage({
|
||||
include: { items: true },
|
||||
}),
|
||||
]);
|
||||
} catch (err) {
|
||||
console.error('Error fetching ledger data:', err);
|
||||
}
|
||||
|
||||
const entries: LedgerEntry[] = [
|
||||
...orders.map((o) => ({
|
||||
|
||||
Reference in New Issue
Block a user