aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes
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
parentf1de78757ebd132acee2f4ebe1c0927a262594f0 (diff)
downloadcoinos-ui-866b78f25c9c8ae9c6cd3d0892aff3933cabf556.tar.gz
coinos-ui-866b78f25c9c8ae9c6cd3d0892aff3933cabf556.zip
internal payment fixes
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/(app)/[username]/(profile)/+layout.svelte5
-rw-r--r--src/routes/(app)/[username]/request/[id]/+page.server.js3
-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
-rw-r--r--src/routes/(static)/+layout.svelte2
6 files changed, 22 insertions, 16 deletions
diff --git a/src/routes/(app)/[username]/(profile)/+layout.svelte b/src/routes/(app)/[username]/(profile)/+layout.svelte
index f3488e4b..dfa25b78 100644
--- a/src/routes/(app)/[username]/(profile)/+layout.svelte
+++ b/src/routes/(app)/[username]/(profile)/+layout.svelte
@@ -134,7 +134,10 @@
{/if}
{#if !subject.anon && subject.username !== user?.username}
<div class="w-full flex">
- <a href={user ? `/send/${subject.username}` : `/${subject.username}/receive`} class="mx-auto">
+ <a
+ href={user ? `/send/${subject.username}` : `/${subject.username}/receive`}
+ class="mx-auto"
+ >
<button class="rounded-full border py-3 px-6 font-bold hover:opacity-80 flex w-60">
<div class="mx-auto flex">
<Icon icon="send" style="mr-2" />
diff --git a/src/routes/(app)/[username]/request/[id]/+page.server.js b/src/routes/(app)/[username]/request/[id]/+page.server.js
index 5fb90bf3..89792ab8 100644
--- a/src/routes/(app)/[username]/request/[id]/+page.server.js
+++ b/src/routes/(app)/[username]/request/[id]/+page.server.js
@@ -4,7 +4,7 @@ import { redirect } from '@sveltejs/kit';
export let load = async ({ cookies, depends, params, parent }) => {
depends('app:invoice');
- let { user } = await parent();
+ let { user } = await parent();
if (!user) throw redirect(307, '/login');
let { request } = await get(`/request/${params.id}`, auth(cookies));
@@ -21,6 +21,5 @@ export let load = async ({ cookies, depends, params, parent }) => {
if (request.requester.username === user.username) throw redirect(307, `/send/${id}`);
}
-
return { request };
};
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 });
diff --git a/src/routes/(static)/+layout.svelte b/src/routes/(static)/+layout.svelte
index dde9fd11..f3a726af 100644
--- a/src/routes/(static)/+layout.svelte
+++ b/src/routes/(static)/+layout.svelte
@@ -1,5 +1,5 @@
<script>
- import { Footer, LandingHeader } from "$comp";
+ import { Footer, LandingHeader } from '$comp';
</script>
<LandingHeader />