diff options
| author | Adam Soltys <[email protected]> | 2025-07-25 23:17:28 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-07-25 23:17:28 -0700 |
| commit | 222a134d33c7d44e9ae6ce34fdbbeb92ed1cfa8a (patch) | |
| tree | aeae6acf3ec91d4bb58e78e833f6d9133cd7b3c0 | |
| parent | bf5ab3fdb6d6c1ffc1e1dc66b737d501e4fd710d (diff) | |
| download | coinos-ui-222a134d33c7d44e9ae6ce34fdbbeb92ed1cfa8a.tar.gz coinos-ui-222a134d33c7d44e9ae6ce34fdbbeb92ed1cfa8a.zip | |
fund authorizations
| -rw-r--r-- | src/routes/(app)/fund/[id]/sweep/[...amount]/+page.server.ts | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/routes/(app)/fund/[id]/sweep/[...amount]/+page.server.ts b/src/routes/(app)/fund/[id]/sweep/[...amount]/+page.server.ts index 021015ee..47dfdaab 100644 --- a/src/routes/(app)/fund/[id]/sweep/[...amount]/+page.server.ts +++ b/src/routes/(app)/fund/[id]/sweep/[...amount]/+page.server.ts @@ -20,7 +20,7 @@ export async function load({ cookies, request, params, parent }) { amount = (amount * sats) / rate; } - const username = randomName(); + const username = randomName() + Math.floor(Math.random() * 99) + 1; const password = randomPassword(); if (!amount) redirect(307, `/fund/${id}`); @@ -34,19 +34,17 @@ export async function load({ cookies, request, params, parent }) { }; let redirectUrl = `/fund/${id}/sweep`; - if (amount) redirectUrl += `/${amount}`; - if (currency) redirectUrl += `/${currency}`; + if (params.amount && !params.currency) redirectUrl += `/${params.amount}`; + if (params.currency) redirectUrl += `/${params.amount}/params.currency}`; await register(user, ip, cookies, redirectUrl); } - let r; try { - r = await post("/take", { amount, id }, auth(cookies)); + ({ amount } = await post("/take", { amount, id }, auth(cookies))); } catch (e) { redirect(307, `/fund/${id}`); } - if (r) redirect(307, `/${user.username}`); return { amount, currency, id, rate, rates, password }; } |
