diff options
| author | Adam Soltys <[email protected]> | 2025-08-26 21:53:38 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-08-26 21:53:38 -0700 |
| commit | 74f8a634073fc04be9983f0e0c39ad46b8df5b67 (patch) | |
| tree | c722fd505d5094c5e29b0dd8d9f800191becfa02 | |
| parent | eb66f787b48a2a52ece890e356fd022380f64c2e (diff) | |
| download | coinos-ui-74f8a634073fc04be9983f0e0c39ad46b8df5b67.tar.gz coinos-ui-74f8a634073fc04be9983f0e0c39ad46b8df5b67.zip | |
fix autopay with tip logic
| -rw-r--r-- | src/routes/(app)/invoice/[id]/tip/+page.server.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/routes/(app)/invoice/[id]/tip/+page.server.ts b/src/routes/(app)/invoice/[id]/tip/+page.server.ts index 23e3a07c..851d3f1b 100644 --- a/src/routes/(app)/invoice/[id]/tip/+page.server.ts +++ b/src/routes/(app)/invoice/[id]/tip/+page.server.ts @@ -19,14 +19,13 @@ export async function load({ cookies, params, parent }) { if (user.tip > 0) { invoice.tip = Math.round(invoice.amount * (user.tip / 100)); invoice = await post(`/invoice/${id}`, { invoice }, auth(cookies)); - } else { - throw new Error("tip"); + p = await post("/payments", { ...invoice, pin }, auth(cookies)); } + } else { + p = await post("/payments", { ...invoice, pin }, auth(cookies)); } - p = await post("/payments", { ...invoice, pin }, auth(cookies)); } catch (e) { const { message } = e as Error; - if (message === "tip") redirect(307, `/invoice/${id}/tip`); fail(400, { message }); } if (p) redirect(307, `/sent/${p.id}`); |
