aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
commit7cc4aa961ff04214ae2926ed2f9d45da1b8b5a65 (patch)
treefc9517fcf34e4ff82f35b1c7865f447be8f27085 /src
parentcd174163168c3bbbb0f12596f945a256ad0b45f6 (diff)
downloadcoinos-ui-7cc4aa961ff04214ae2926ed2f9d45da1b8b5a65.tar.gz
coinos-ui-7cc4aa961ff04214ae2926ed2f9d45da1b8b5a65.zip
move variable definition
Diffstat (limited to 'src')
-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');