diff options
Diffstat (limited to 'src/routes/(app)/pos/+page.server.ts')
| -rw-r--r-- | src/routes/(app)/pos/+page.server.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/routes/(app)/pos/+page.server.ts b/src/routes/(app)/pos/+page.server.ts new file mode 100644 index 00000000..f7a3fda3 --- /dev/null +++ b/src/routes/(app)/pos/+page.server.ts @@ -0,0 +1,21 @@ +import { PUBLIC_COINOS_URL } from "$env/static/public"; +import { fd } from "$lib/utils"; +import { hex } from "@scure/base"; + +export const actions = { + default: async ({ fetch, request }) => { + const body = await fd(request); + console.log("POSTING", body); + const res = await fetch(`${PUBLIC_COINOS_URL}/flash`, { + method: "POST", + body: JSON.stringify(body), + headers: { + "content-type": "application/json", + accept: "application/octet-stream", + }, + }); + + const buf = new Uint8Array(await res.arrayBuffer()); + return { data: hex.encode(buf) }; + }, +}; |
