diff options
| author | Adam Soltys <[email protected]> | 2026-02-16 11:51:25 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-16 11:51:25 -0800 |
| commit | e39bf4f977bba2952a7de4a307b14c5ec862a3a7 (patch) | |
| tree | 1eac038796d376ad073eae6246bf43f15454bd66 /src/routes/passkey | |
| parent | fe104c2364de35bcdb2a10ca469cd25c12b04289 (diff) | |
| download | coinos-ui-e39bf4f977bba2952a7de4a307b14c5ec862a3a7.tar.gz coinos-ui-e39bf4f977bba2952a7de4a307b14c5ec862a3a7.zip | |
passkey auth
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, + }); +} |
