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