aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-03-23 08:04:01 -0700
committerAdam Soltys <[email protected]>2023-03-23 08:04:01 -0700
commite1fe2fb22efb74a855a2ba3ca5acb1bba774fa0f (patch)
treefc9517fcf34e4ff82f35b1c7865f447be8f27085 /src/routes
parent4bf37cacf8502d5937187788b6738b909146940c (diff)
downloadcoinos-ui-e1fe2fb22efb74a855a2ba3ca5acb1bba774fa0f.tar.gz
coinos-ui-e1fe2fb22efb74a855a2ba3ca5acb1bba774fa0f.zip
move variable definition
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/(app)/send/user/[username]/[...amount]/+page.server.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/routes/(app)/send/user/[username]/[...amount]/+page.server.js b/src/routes/(app)/send/user/[username]/[...amount]/+page.server.js
index 0a9dda6e..ba758036 100644
--- a/src/routes/(app)/send/user/[username]/[...amount]/+page.server.js
+++ b/src/routes/(app)/send/user/[username]/[...amount]/+page.server.js
@@ -3,12 +3,13 @@ import { types, sats, fd, auth, get, post } from '$lib/utils';
export async function load({ cookies, params, parent }) {
let subject = await get(`/users/${params.username}`);
- if (subject.username === user?.username) throw error(500, { message: 'Cannot send to self' });
let { rates, user } = await parent();
let { username } = params;
let [amount, currency] = params.amount.split('/');
+ if (subject.username === user?.username) throw error(500, { message: 'Cannot send to self' });
+
if (amount) {
let rate = rates[currency ? currency.toUpperCase() : subject.currency];
if (!rate) throw error(500, 'Invalid currency symbol');