aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-08-26 21:53:38 -0700
committerAdam Soltys <[email protected]>2025-09-10 10:46:49 -0700
commit19646ca06597a8e4d14a510208f1519c09cfed3f (patch)
treeb287b29e961ce35015f3bbb398075bdf530415c7 /src
parentfd098a90952269db708f4d2d21de085c968e835e (diff)
downloadcoinos-ui-19646ca06597a8e4d14a510208f1519c09cfed3f.tar.gz
coinos-ui-19646ca06597a8e4d14a510208f1519c09cfed3f.zip
fix autopay with tip logic
Diffstat (limited to 'src')
-rw-r--r--src/routes/(app)/invoice/[id]/tip/+page.server.ts7
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}`);