From ac3a6407a95879ce68e28a1633697de6d7a95770 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 16 Jan 2025 14:56:32 -0800 Subject: event viewer and zaps --- src/routes/(app)/post/+server.ts | 9 +++++++++ src/routes/(app)/post/[...path]/+server.ts | 12 ++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/routes/(app)/post/+server.ts create mode 100644 src/routes/(app)/post/[...path]/+server.ts (limited to 'src/routes/(app)/post') diff --git a/src/routes/(app)/post/+server.ts b/src/routes/(app)/post/+server.ts new file mode 100644 index 00000000..35c04186 --- /dev/null +++ b/src/routes/(app)/post/+server.ts @@ -0,0 +1,9 @@ +export async function POST({ cookies, params, request }) { + const body = await request.json(); + try { + const result = await post("/event", body, auth(cookies)); + return json(result); + } catch (e: any) { + error(500, e.message); + } +} diff --git a/src/routes/(app)/post/[...path]/+server.ts b/src/routes/(app)/post/[...path]/+server.ts new file mode 100644 index 00000000..84df9a36 --- /dev/null +++ b/src/routes/(app)/post/[...path]/+server.ts @@ -0,0 +1,12 @@ +import { PUBLIC_COINOS_URL as base } from "$env/static/public"; +import { auth } from "$lib/utils"; + +export async function POST({ cookies, fetch, params, request }) { + const { path } = params; + + return fetch(`${base}/${path}`, { + method: "POST", + body: JSON.stringify(await request.json()), + headers: { "Content-Type": "application/json", ...auth(cookies) }, + }); +} -- cgit v1.2.3