import { error } from '@sveltejs/kit'; import { getInvoice } from '$lib/server/invoices.js'; export function load({ params }) { const result = getInvoice(params.id); if (!result || result.invoice.status !== 'saved') { throw error(404, 'Invoice not found'); } return result; }