diff options
| author | Adam Soltys <[email protected]> | 2025-03-05 13:35:31 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-03-05 15:06:48 -0800 |
| commit | bbdae13248476e9ff49fcefc64cf8c8e97b5f679 (patch) | |
| tree | cb3696e680f7417f5988375043341e495b7cad3d /routes/invoices.ts | |
| parent | 118386e0691a0c80a0d8c19ab40bd3abf6859b84 (diff) | |
| download | coinos-server-bbdae13248476e9ff49fcefc64cf8c8e97b5f679.tar.gz coinos-server-bbdae13248476e9ff49fcefc64cf8c8e97b5f679.zip | |
use getInvoice helper
Diffstat (limited to 'routes/invoices.ts')
| -rw-r--r-- | routes/invoices.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/routes/invoices.ts b/routes/invoices.ts index 8b71208d..0881c69f 100644 --- a/routes/invoices.ts +++ b/routes/invoices.ts @@ -1,5 +1,5 @@ import config from "$config"; -import { db, g } from "$lib/db"; +import { db } from "$lib/db"; import { generate } from "$lib/invoices"; import { err } from "$lib/logging"; import { bail, fields, getInvoice, getUser } from "$lib/utils"; @@ -10,8 +10,7 @@ export default { const { params: { id }, } = req; - let invoice = await g(`invoice:${id}`); - if (typeof invoice === "string") invoice = await g(`invoice:${invoice}`); + const invoice = await getInvoice(id); if (invoice) { invoice.secret = undefined; @@ -31,7 +30,12 @@ export default { try { res.send(await generate({ invoice, user })); } catch (e) { - err("problem generating invoice", req.user?.username, body.user?.username, e.message); + err( + "problem generating invoice", + req.user?.username, + body.user?.username, + e.message, + ); bail(res, e.message); } }, |
