aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/events
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/(app)/events')
-rw-r--r--src/routes/(app)/events/+server.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/routes/(app)/events/+server.ts b/src/routes/(app)/events/+server.ts
index 95df0bc5..746f2caf 100644
--- a/src/routes/(app)/events/+server.ts
+++ b/src/routes/(app)/events/+server.ts
@@ -1,6 +1,12 @@
import { auth, post } from "$lib/utils";
-import { json } from "@sveltejs/kit";
+import { json, error } from "@sveltejs/kit";
export async function POST({ cookies, request }) {
- return json(post("/event", await request.json(), auth(cookies)));
+ let body = await request.json();
+ try {
+ let result = await post("/event", body, auth(cookies));
+ return json(result);
+ } catch (e: any) {
+ error(500, e.message);
+ }
}