From 5c37f87a58ef5d84a183cb042758a25a4b9cc40d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 18 Dec 2024 13:42:22 -0800 Subject: printer page --- src/routes/(app)/printer/+page.server.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/routes/(app)/printer/+page.server.ts (limited to 'src/routes/(app)/printer/+page.server.ts') 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())) }; + }, +}; -- cgit v1.2.3