diff options
Diffstat (limited to 'src/routes/passkey')
| -rw-r--r-- | src/routes/passkey/[...path]/+server.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/routes/passkey/[...path]/+server.ts b/src/routes/passkey/[...path]/+server.ts new file mode 100644 index 00000000..0f94c605 --- /dev/null +++ b/src/routes/passkey/[...path]/+server.ts @@ -0,0 +1,18 @@ +import { PUBLIC_COINOS_URL as base } from "$env/static/public"; +import { auth } from "$lib/utils"; + +export async function POST({ cookies, fetch, params, request, url }) { + const { path } = params; + const token = cookies.get("token"); + const headers: Record<string, string> = { "Content-Type": "application/json" }; + if (token) Object.assign(headers, auth(cookies)); + + const body = await request.json(); + body.origin = url.origin; + + return fetch(`${base}/passkey/${path}`, { + method: "POST", + body: JSON.stringify(body), + headers, + }); +} |
