aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/account
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-10-31 09:34:16 -0700
committerAdam Soltys <[email protected]>2024-10-31 09:34:16 -0700
commit243abb0a3d29e8e34e263eec843488e3bdb468a4 (patch)
treebe55931ba0f3c110c3001f56a5339cb63e78b761 /src/routes/(app)/account
parent4742e72ec25823ceeea7848fb2e1f868bed7f472 (diff)
downloadcoinos-ui-243abb0a3d29e8e34e263eec843488e3bdb468a4.tar.gz
coinos-ui-243abb0a3d29e8e34e263eec843488e3bdb468a4.zip
biome
Diffstat (limited to 'src/routes/(app)/account')
-rw-r--r--src/routes/(app)/account/+server.ts14
-rw-r--r--src/routes/(app)/account/[id]/+page.server.ts30
2 files changed, 22 insertions, 22 deletions
diff --git a/src/routes/(app)/account/+server.ts b/src/routes/(app)/account/+server.ts
index bcf73ac8..e6dc7e0c 100644
--- a/src/routes/(app)/account/+server.ts
+++ b/src/routes/(app)/account/+server.ts
@@ -2,11 +2,11 @@ import { auth, post } from "$lib/utils";
import { error, json } from "@sveltejs/kit";
export async function POST({ cookies, request }) {
- try {
- let body = await request.json();
- return json(await post(`/accounts`, body, auth(cookies)));
- } catch (e: any) {
- console.log(e);
- error(500, e.message);
- }
+ try {
+ const body = await request.json();
+ return json(await post("/accounts", body, auth(cookies)));
+ } catch (e: any) {
+ console.log(e);
+ error(500, e.message);
+ }
}
diff --git a/src/routes/(app)/account/[id]/+page.server.ts b/src/routes/(app)/account/[id]/+page.server.ts
index e521f15b..b91a0788 100644
--- a/src/routes/(app)/account/[id]/+page.server.ts
+++ b/src/routes/(app)/account/[id]/+page.server.ts
@@ -1,24 +1,24 @@
import { error, redirect } from "@sveltejs/kit";
import { auth, get, post, fd } from "$lib/utils";
-export let load = async ({ cookies, params }) => {
- let account = await get(`/account/${params.id}`, auth(cookies));
- return { account };
+export const load = async ({ cookies, params }) => {
+ const account = await get(`/account/${params.id}`, auth(cookies));
+ return { account };
};
export const actions = {
- default: async ({ cookies, params, request }) => {
- let { id } = params;
- let body = await fd(request);
- let username = cookies.get("username");
+ default: async ({ cookies, params, request }) => {
+ const { id } = params;
+ const body = await fd(request);
+ const username = cookies.get("username");
- try {
- await post(`/account/${id}`, body, auth(cookies));
- } catch (e: any) {
- console.log(e);
- error(400, { message: e.message });
- }
+ try {
+ await post(`/account/${id}`, body, auth(cookies));
+ } catch (e: any) {
+ console.log(e);
+ error(400, { message: e.message });
+ }
- redirect(303, `/${username}`);
- },
+ redirect(303, `/${username}`);
+ },
};