aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/send/invoice
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-09-24 20:12:43 -0700
committerAdam Soltys <[email protected]>2024-09-24 20:12:43 -0700
commitb008ad7a87ae101d814d774533ed36243b9b8457 (patch)
tree42101a3ccf47f7b7290637700b90a843476e56f7 /src/routes/(app)/send/invoice
parente139c25a127c0b3fb655e7a07ed6963335a0d025 (diff)
parent550678bee306d1593dc4ba561bf34421f2657484 (diff)
downloadcoinos-ui-b008ad7a87ae101d814d774533ed36243b9b8457.tar.gz
coinos-ui-b008ad7a87ae101d814d774533ed36243b9b8457.zip
Merge branch 'self-custody'
Diffstat (limited to 'src/routes/(app)/send/invoice')
-rw-r--r--src/routes/(app)/send/invoice/[id]/+page.server.ts13
-rw-r--r--src/routes/(app)/send/invoice/[id]/+page.svelte8
2 files changed, 9 insertions, 12 deletions
diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.ts b/src/routes/(app)/send/invoice/[id]/+page.server.ts
index ed0198cf..6c89912d 100644
--- a/src/routes/(app)/send/invoice/[id]/+page.server.ts
+++ b/src/routes/(app)/send/invoice/[id]/+page.server.ts
@@ -7,31 +7,32 @@ export async function load({ params: { id }, parent }) {
let invoice = await get(`/invoice/${id}`);
if (invoice.prompt && invoice.tip === null)
- redirect(307, `/${invoice.user.username}/invoice/${id}/tip`);
+ redirect(307, `/invoice/${id}/tip`);
if (invoice.memoPrompt && invoice.memo === null)
- redirect(307, `/${invoice.user.username}/invoice/${id}/memo`);
+ redirect(307, `/invoice/${id}/memo`);
- if (invoice.user.username === user?.username)
+ if (invoice.account === user?.id)
error(500, { message: "Cannot send to self" });
- if (!user) redirect(307, `/${invoice.user.username}/invoice/${id}`);
+ if (!user) redirect(307, `/invoice/${id}`);
return { invoice, rates, user };
}
export const actions = {
default: async ({ cookies, params: { id }, request }) => {
+ let p;
try {
let body = await fd(request);
body.hash = id;
- await post("/payments", body, auth(cookies));
+ p = await post("/payments", body, auth(cookies));
} catch (e: any) {
console.log("payment failed", id, e);
error(500, e.message);
}
- redirect(307, "/sent");
+ redirect(307, `/sent/${p.id}`);
},
};
diff --git a/src/routes/(app)/send/invoice/[id]/+page.svelte b/src/routes/(app)/send/invoice/[id]/+page.svelte
index 81a2c521..4348e473 100644
--- a/src/routes/(app)/send/invoice/[id]/+page.svelte
+++ b/src/routes/(app)/send/invoice/[id]/+page.svelte
@@ -52,7 +52,7 @@
let toggle = () => (submitting = !submitting);
let external = async () => {
- let { id } = await post(`/${recipient.username}/invoice`, {
+ let { id } = await post(`/invoice`, {
invoice: {
...invoice,
type: "lightning",
@@ -62,7 +62,7 @@
user: { username: recipient.username },
});
- goto(`/${recipient.username}/invoice/${id}?options=true`, {
+ goto(`/invoice/${id}?options=true`, {
invalidateAll: true,
});
};
@@ -93,10 +93,6 @@
// });
</script>
-<button class="ml-5 md:ml-20 mt-5 md:mt-10 hover:opacity-80" on:click={back}>
- <Icon icon="arrow-left" style="w-10" />
-</button>
-
{#if form?.message}
<div class="text-red-600 text-center">
{form.message}