diff options
| author | Adam Soltys <[email protected]> | 2024-10-31 09:34:16 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-10-31 09:34:16 -0700 |
| commit | 243abb0a3d29e8e34e263eec843488e3bdb468a4 (patch) | |
| tree | be55931ba0f3c110c3001f56a5339cb63e78b761 /src/routes/(app)/send | |
| parent | 4742e72ec25823ceeea7848fb2e1f868bed7f472 (diff) | |
| download | coinos-ui-243abb0a3d29e8e34e263eec843488e3bdb468a4.tar.gz coinos-ui-243abb0a3d29e8e34e263eec843488e3bdb468a4.zip | |
biome
Diffstat (limited to 'src/routes/(app)/send')
6 files changed, 60 insertions, 60 deletions
diff --git a/src/routes/(app)/send/[...text]/+page.server.ts b/src/routes/(app)/send/[...text]/+page.server.ts index 906d6563..b0baa2d5 100644 --- a/src/routes/(app)/send/[...text]/+page.server.ts +++ b/src/routes/(app)/send/[...text]/+page.server.ts @@ -3,17 +3,17 @@ import { fail } from "@sveltejs/kit"; import parse from "$lib/parse"; export async function load({ cookies, params, url }) { - let { text } = params; + const { text } = params; - await parse(text, url.host); - let contacts = await get("/contacts", auth(cookies)); - return { contacts }; + await parse(text, url.host); + const contacts = await get("/contacts", auth(cookies)); + return { contacts }; } export const actions = { - default: async ({ request, url }) => { - let { text } = await fd(request); - await parse(text, url.host); - return fail(400, { error: "default" }); - }, + default: async ({ request, url }) => { + const { text } = await fd(request); + await parse(text, url.host); + return fail(400, { error: "default" }); + }, }; diff --git a/src/routes/(app)/send/bitcoin/[address]/+layout.server.ts b/src/routes/(app)/send/bitcoin/[address]/+layout.server.ts index a6edf8b0..68191311 100644 --- a/src/routes/(app)/send/bitcoin/[address]/+layout.server.ts +++ b/src/routes/(app)/send/bitcoin/[address]/+layout.server.ts @@ -2,22 +2,22 @@ import { auth, get } from "$lib/utils"; import { redirect } from "@sveltejs/kit"; export async function load({ cookies, params, parent }) { - let { user } = await parent(); - let aid = cookies.get("aid"); - let { address } = params; - let { balance } = await get(`/account/${aid}`, auth(cookies)); + const { user } = await parent(); + const aid = cookies.get("aid"); + const { address } = params; + const { balance } = await get(`/account/${aid}`, auth(cookies)); - try { - let invoice = await get(`/invoice/${address}`); + try { + const invoice = await get(`/invoice/${address}`); - if (invoice) { - let recipient = await get(`/users/${invoice.uid}`); - if (recipient?.id !== user.id) - redirect(307, `/pay/${recipient.username}`); - } - } catch (e) { - // invoice not found - } + if (invoice) { + const recipient = await get(`/users/${invoice.uid}`); + if (recipient?.id !== user.id) + redirect(307, `/pay/${recipient.username}`); + } + } catch (e) { + // invoice not found + } - return { balance }; + return { balance }; } diff --git a/src/routes/(app)/send/ecash/+page.server.ts b/src/routes/(app)/send/ecash/+page.server.ts index 64de18c7..6a535524 100644 --- a/src/routes/(app)/send/ecash/+page.server.ts +++ b/src/routes/(app)/send/ecash/+page.server.ts @@ -2,17 +2,17 @@ import { error, redirect } from "@sveltejs/kit"; import { auth, post, fd } from "$lib/utils"; export const actions = { - default: async ({ cookies, request }) => { - let id; - let body = await fd(request); + default: async ({ cookies, request }) => { + let id; + const body = await fd(request); - try { - ({ id } = await post("/mint", body, auth(cookies))); - } catch (e: any) { - console.log("problem creating ecash", e); - error(400, { message: e.message }); - } + try { + ({ id } = await post("/mint", body, auth(cookies))); + } catch (e: any) { + console.log("problem creating ecash", e); + error(400, { message: e.message }); + } - redirect(307, `/ecash/${id}`); - }, + redirect(307, `/ecash/${id}`); + }, }; diff --git a/src/routes/(app)/send/fund/[name]/[...amount]/+page.server.ts b/src/routes/(app)/send/fund/[name]/[...amount]/+page.server.ts index 2897b159..ed39f96b 100644 --- a/src/routes/(app)/send/fund/[name]/[...amount]/+page.server.ts +++ b/src/routes/(app)/send/fund/[name]/[...amount]/+page.server.ts @@ -2,16 +2,16 @@ import { fail, redirect } from "@sveltejs/kit"; import { auth, fd, post } from "$lib/utils"; export const actions = { - default: async ({ cookies, request }) => { - let body = await fd(request); - let p; + default: async ({ cookies, request }) => { + const body = await fd(request); + let p; - try { - p = await post("/payments", body, auth(cookies)); - } catch (e: any) { - return fail(400, { message: e.message }); - } + try { + p = await post("/payments", body, auth(cookies)); + } catch (e: any) { + return fail(400, { message: e.message }); + } - if (p) redirect(307, `/fund/${body.name}`); - }, + if (p) redirect(307, `/fund/${body.name}`); + }, }; diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.ts b/src/routes/(app)/send/invoice/[id]/+page.server.ts index f1c00c0f..c65a6c7b 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.ts +++ b/src/routes/(app)/send/invoice/[id]/+page.server.ts @@ -14,7 +14,7 @@ export async function load({ cookies, params: { id }, parent }) { redirect(307, `/invoice/${id}/memo`); if (invoice.aid === aid) error(500, { message: "Cannot send to self" }); - else if (user) redirect(307, `/send/${invoice.type}/${invoice.hash}`); + else if (user) redirect(307, `/send/${invoice.type}/${invoice.hash}`); if (!user) redirect(307, `/invoice/${id}`); diff --git a/src/routes/(app)/send/lightning/[payreq]/+page.server.ts b/src/routes/(app)/send/lightning/[payreq]/+page.server.ts index 89493539..0df87255 100644 --- a/src/routes/(app)/send/lightning/[payreq]/+page.server.ts +++ b/src/routes/(app)/send/lightning/[payreq]/+page.server.ts @@ -2,24 +2,24 @@ import { fail, redirect } from "@sveltejs/kit"; import { fd, auth, post } from "$lib/utils"; export async function load({ cookies, params }) { - return post("/parse", params, auth(cookies)); + return post("/parse", params, auth(cookies)); } export const actions = { - setAmount: async ({ request }) => fd(request), + setAmount: async ({ request }) => fd(request), - send: async ({ cookies, request }) => { - let p; - try { - let body = await fd(request); + send: async ({ cookies, request }) => { + let p; + try { + const body = await fd(request); - p = await post("/payments", body, auth(cookies)); - } catch (e: any) { - if (e.message.includes("unusable") || e.message.includes("routes")) - e.message = "payments.failedToRoute"; - return fail(400, { message: e.message }); - } + p = await post("/payments", body, auth(cookies)); + } catch (e: any) { + if (e.message.includes("unusable") || e.message.includes("routes")) + e.message = "payments.failedToRoute"; + return fail(400, { message: e.message }); + } - redirect(307, `/sent/${p.id}`); - }, + redirect(307, `/sent/${p.id}`); + }, }; |
