aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/items
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)/items
parent4742e72ec25823ceeea7848fb2e1f868bed7f472 (diff)
downloadcoinos-ui-243abb0a3d29e8e34e263eec843488e3bdb468a4.tar.gz
coinos-ui-243abb0a3d29e8e34e263eec843488e3bdb468a4.zip
biome
Diffstat (limited to 'src/routes/(app)/items')
-rw-r--r--src/routes/(app)/items/[id]/+page.server.ts26
-rw-r--r--src/routes/(app)/items/create/+page.server.ts20
2 files changed, 23 insertions, 23 deletions
diff --git a/src/routes/(app)/items/[id]/+page.server.ts b/src/routes/(app)/items/[id]/+page.server.ts
index 67cebd93..32924d03 100644
--- a/src/routes/(app)/items/[id]/+page.server.ts
+++ b/src/routes/(app)/items/[id]/+page.server.ts
@@ -1,21 +1,21 @@
import { fd, auth, get, post } from "$lib/utils";
import { fail, redirect } from "@sveltejs/kit";
-export let load = async ({ params: { id } }) => {
- let item = await get(`/items/${id}`);
- return { item };
+export const load = async ({ params: { id } }) => {
+ const item = await get(`/items/${id}`);
+ return { item };
};
export const actions = {
- default: async ({ cookies, request, url }) => {
- let form = await fd(request);
- try {
- await post(`/items`, form, auth(cookies));
- } catch (e: any) {
- return fail(400, { message: e.message });
- }
+ default: async ({ cookies, request, url }) => {
+ const form = await fd(request);
+ try {
+ await post("/items", form, auth(cookies));
+ } catch (e: any) {
+ return fail(400, { message: e.message });
+ }
- let success = `/${url.pathname.split("/")[1]}`;
- redirect(307, success);
- },
+ const success = `/${url.pathname.split("/")[1]}`;
+ redirect(307, success);
+ },
};
diff --git a/src/routes/(app)/items/create/+page.server.ts b/src/routes/(app)/items/create/+page.server.ts
index 2e006a3e..e125e047 100644
--- a/src/routes/(app)/items/create/+page.server.ts
+++ b/src/routes/(app)/items/create/+page.server.ts
@@ -2,15 +2,15 @@ import { fail, redirect } from "@sveltejs/kit";
import { fd, auth, post } from "$lib/utils";
export const actions = {
- default: async ({ cookies, request, url }) => {
- let form = await fd(request);
- try {
- await post("/items", form, auth(cookies));
- } catch (e: any) {
- return fail(400, { message: e.message });
- }
+ default: async ({ cookies, request, url }) => {
+ const form = await fd(request);
+ try {
+ await post("/items", form, auth(cookies));
+ } catch (e: any) {
+ return fail(400, { message: e.message });
+ }
- let success = `/${url.pathname.split("/")[1]}`;
- redirect(307, success);
- },
+ const success = `/${url.pathname.split("/")[1]}`;
+ redirect(307, success);
+ },
};