aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/invoice.js6
-rw-r--r--src/lib/utils.js6
2 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/invoice.js b/src/lib/invoice.js
index 5b939079..bb75d4cb 100644
--- a/src/lib/invoice.js
+++ b/src/lib/invoice.js
@@ -7,6 +7,7 @@ export default async ({ cookies, request, url }) => {
let rates = await get('/rates');
let amount = parseInt(form.get('amount'));
let request_id = form.get('request_id');
+ if (request_id === 'undefined') request_id = undefined;
let invoice = {
amount,
@@ -19,11 +20,12 @@ export default async ({ cookies, request, url }) => {
let user = { username: form.get('username'), currency: form.get('currency') };
- let { hash } = await post('/invoice', { invoice, user }, auth(cookies));
+ invoice = await post('/invoice', { invoice, user }, auth(cookies));
+ let { hash } = invoice;
if (request_id) {
if (url.pathname.endsWith('tip')) {
- throw redirect(307, `/send/${hash}`);
+ throw redirect(307, `/send/invoice/${hash}`);
}
throw redirect(307, `/${user.username}/request/${request_id}`);
diff --git a/src/lib/utils.js b/src/lib/utils.js
index 24991100..ef1e997b 100644
--- a/src/lib/utils.js
+++ b/src/lib/utils.js
@@ -4,9 +4,13 @@ import { browser } from '$app/environment';
import { toast } from '@zerodevx/svelte-toast';
import { goto } from '$app/navigation';
import { PUBLIC_COINOS_URL } from '$env/static/public';
+import { page } from '$app/stores';
+import { get as getStore } from 'svelte/store';
export function scroll(section) {
- section.scrollIntoView({ behavior: 'smooth' });
+ if (getStore(page).url.pathname !== '/') goto('/');
+ console.log("section", section);
+ setTimeout(() => section.scrollIntoView({ behavior: 'smooth' }), 500);
}
const base = browser ? '' : PUBLIC_COINOS_URL;