aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/send
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-02-08 13:20:22 -0800
committerAdam Soltys <[email protected]>2023-02-08 13:20:22 -0800
commit866b78f25c9c8ae9c6cd3d0892aff3933cabf556 (patch)
tree4e62b2fc800df4f0ef48ee5445d4b1639f9facd7 /src/routes/(app)/send
parentf1de78757ebd132acee2f4ebe1c0927a262594f0 (diff)
downloadcoinos-ui-866b78f25c9c8ae9c6cd3d0892aff3933cabf556.tar.gz
coinos-ui-866b78f25c9c8ae9c6cd3d0892aff3933cabf556.zip
internal payment fixes
Diffstat (limited to 'src/routes/(app)/send')
-rw-r--r--src/routes/(app)/send/[...text]/+page.server.js15
-rw-r--r--src/routes/(app)/send/[...text]/+page.svelte9
-rw-r--r--src/routes/(app)/send/invoice/[id]/+page.server.js4
3 files changed, 16 insertions, 12 deletions
diff --git a/src/routes/(app)/send/[...text]/+page.server.js b/src/routes/(app)/send/[...text]/+page.server.js
index 4c2776f5..d09b4da9 100644
--- a/src/routes/(app)/send/[...text]/+page.server.js
+++ b/src/routes/(app)/send/[...text]/+page.server.js
@@ -63,24 +63,21 @@ let parse = async (t, host) => {
if (user) throw redirect(307, `/send/user/${t}`);
- // pot
+ // pot
let pot;
try {
pot = await get(`/pot/${t}`);
- console.log(pot);
- } catch (e) {
- }
+ } catch (e) {}
if (pot) throw redirect(307, `/send/pot/${t}`);
- // invoice
- let invoice;
+ // invoice
+ let invoice;
try {
invoice = await get(`/invoice/${t}`);
- } catch (e) {
- }
+ } catch (e) {}
- if (invoice) throw redirect(307, `/send/invoice/${invoice.hash}`);
+ if (invoice) throw redirect(307, `/send/invoice/${invoice.hash}`);
};
export async function load({ cookies, params, request, url }) {
diff --git a/src/routes/(app)/send/[...text]/+page.svelte b/src/routes/(app)/send/[...text]/+page.svelte
index 2a9df12a..5a376f9f 100644
--- a/src/routes/(app)/send/[...text]/+page.svelte
+++ b/src/routes/(app)/send/[...text]/+page.svelte
@@ -38,9 +38,14 @@
<form method="POST" use:enhance>
{#if form?.error}
<div class="mb-5">
- <div class="text-secondary">Could not find anything with that name. Would you like to create a new pot?</div>
+ <div class="text-secondary">
+ Could not find anything with that name. Would you like to create a new pot?
+ </div>
<div class="w-full flex justify-center">
- <a href={`/send/pot/${text}`}><button class="bg-black text-white border rounded-full px-6 py-2 font-bold">Yes</button></a>
+ <a href={`/send/pot/${text}`}
+ ><button class="bg-black text-white border rounded-full px-6 py-2 font-bold">Yes</button
+ ></a
+ >
</div>
</div>
{/if}
diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.js b/src/routes/(app)/send/invoice/[id]/+page.server.js
index 6b7823ce..2df19985 100644
--- a/src/routes/(app)/send/invoice/[id]/+page.server.js
+++ b/src/routes/(app)/send/invoice/[id]/+page.server.js
@@ -11,10 +11,12 @@ export async function load({ params: { id }, parent }) {
}
export const actions = {
- default: async ({ cookies, request }) => {
+ default: async ({ cookies, params: { hash }, request }) => {
try {
let body = Object.fromEntries(await request.formData());
let { confirmed } = body;
+ body.amount = parseInt(body.amount);
+ body.hash = hash;
if (!confirmed) {
return fail(400, { amount, confirm: true });