diff options
Diffstat (limited to 'src/routes/(app)/fund')
| -rw-r--r-- | src/routes/(app)/fund/[id]/+page.server.ts | 24 | ||||
| -rw-r--r-- | src/routes/(app)/fund/[id]/sweep/+page.server.ts | 14 | ||||
| -rw-r--r-- | src/routes/(app)/fund/[id]/withdraw/+page.server.ts | 22 | ||||
| -rw-r--r-- | src/routes/(app)/fund/[id]/withdraw/+server.ts | 2 |
4 files changed, 31 insertions, 31 deletions
diff --git a/src/routes/(app)/fund/[id]/+page.server.ts b/src/routes/(app)/fund/[id]/+page.server.ts index 6fd3af68..4f189133 100644 --- a/src/routes/(app)/fund/[id]/+page.server.ts +++ b/src/routes/(app)/fund/[id]/+page.server.ts @@ -2,22 +2,22 @@ import { redirect } from "@sveltejs/kit"; import { auth, get, post } from "$lib/utils"; import Qr from "qrcode-base64"; -export let load = async ({ params: { id }, url }) => { - let { amount, payments } = await get(`/fund/${id}`); +export const load = async ({ params: { id }, url }) => { + const { amount, payments } = await get(`/fund/${id}`); - let src = Qr.drawImg(url.href, { size: 300 }); - return { amount, payments, src }; + const src = Qr.drawImg(url.href, { size: 300 }); + return { amount, payments, src }; }; export const actions = { - default: async ({ cookies, locals, params }) => { - let { user } = locals; + default: async ({ cookies, locals, params }) => { + const { user } = locals; - if (user) { - await post("/redeem", params, auth(cookies)); - redirect(307, `/payments`); - } + if (user) { + await post("/redeem", params, auth(cookies)); + redirect(307, "/payments"); + } - redirect(307, "/register"); - }, + redirect(307, "/register"); + }, }; diff --git a/src/routes/(app)/fund/[id]/sweep/+page.server.ts b/src/routes/(app)/fund/[id]/sweep/+page.server.ts index 613cf8e2..5bb42fa4 100644 --- a/src/routes/(app)/fund/[id]/sweep/+page.server.ts +++ b/src/routes/(app)/fund/[id]/sweep/+page.server.ts @@ -2,12 +2,12 @@ import { get, auth, post } from "$lib/utils"; import { redirect } from "@sveltejs/kit"; export async function load({ cookies, params, parent }) { - let { user } = await parent(); - let { id } = params; - let { amount } = await get(`/fund/${id}`); + const { user } = await parent(); + const { id } = params; + const { amount } = await get(`/fund/${id}`); - if (!amount) redirect(307, `/fund/${id}`); - if (!user) redirect(307, `/register?redirect=/fund/${id}/sweep`); - await post("/take", { amount, id }, auth(cookies)); - return { amount, id }; + if (!amount) redirect(307, `/fund/${id}`); + if (!user) redirect(307, `/register?redirect=/fund/${id}/sweep`); + await post("/take", { amount, id }, auth(cookies)); + return { amount, id }; } diff --git a/src/routes/(app)/fund/[id]/withdraw/+page.server.ts b/src/routes/(app)/fund/[id]/withdraw/+page.server.ts index f0379153..1e477918 100644 --- a/src/routes/(app)/fund/[id]/withdraw/+page.server.ts +++ b/src/routes/(app)/fund/[id]/withdraw/+page.server.ts @@ -2,19 +2,19 @@ import { fail, redirect } from "@sveltejs/kit"; import { fd, auth, post } from "$lib/utils"; export async function load({ parent }) { - let { user } = await parent(); - if (!user) redirect(307, "/register"); + const { user } = await parent(); + if (!user) redirect(307, "/register"); } export const actions = { - default: async ({ cookies, request }) => { - let body = await fd(request); - try { - await post("/take", body, auth(cookies)); - } catch (e: any) { - return fail(400, { message: e.message }); - } + default: async ({ cookies, request }) => { + const body = await fd(request); + try { + await post("/take", body, auth(cookies)); + } catch (e: any) { + return fail(400, { message: e.message }); + } - redirect(307, `/fund/${body.id}`); - }, + redirect(307, `/fund/${body.id}`); + }, }; diff --git a/src/routes/(app)/fund/[id]/withdraw/+server.ts b/src/routes/(app)/fund/[id]/withdraw/+server.ts index 96d66413..dabef6f8 100644 --- a/src/routes/(app)/fund/[id]/withdraw/+server.ts +++ b/src/routes/(app)/fund/[id]/withdraw/+server.ts @@ -2,5 +2,5 @@ import { json } from "@sveltejs/kit"; import { auth, post } from "$lib/utils"; export async function POST({ cookies, request }) { - return json(await post("/take", await request.json(), auth(cookies))); + return json(await post("/take", await request.json(), auth(cookies))); } |
