Implement receipt management features including creation, loading, and display of receipts. Refactor related components and enhance UI with dialogs for adding new receipts. Update type definitions and improve error handling for better user experience.
CI / build (push) Has been skipped
CI / deploy (push) Failing after 1m15s

This commit is contained in:
eewing
2026-02-19 09:55:26 -06:00
parent c6b30100bd
commit 567d7e3e13
13 changed files with 449 additions and 37 deletions
+23
View File
@@ -0,0 +1,23 @@
import { error } from "@sveltejs/kit";
import type { PageServerLoad } from "./$types";
import type { StackqReceipt } from "$lib/types/receipts";
const COLLECTION = "Stackq_Receipts";
export const load: PageServerLoad = async ({ params, locals }) => {
const { id } = params;
try {
const record = await locals.pb
.collection(COLLECTION)
.getOne<StackqReceipt>(id, { expand: "User" });
return { receipt: record };
} catch (err: unknown) {
const is404 =
err &&
typeof err === "object" &&
"status" in err &&
(err as { status: number }).status === 404;
if (is404) throw error(404, "Receipt not found");
throw err;
}
};