aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/printer/+page.server.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-12-18 13:42:22 -0800
committerAdam Soltys <[email protected]>2024-12-18 13:42:40 -0800
commit5c37f87a58ef5d84a183cb042758a25a4b9cc40d (patch)
tree2b143684692dbff3b9c9a885f18aa08968635e44 /src/routes/(app)/printer/+page.server.ts
parentefc288bc73f5a966467a6cf08a10966caff04f57 (diff)
downloadcoinos-ui-5c37f87a58ef5d84a183cb042758a25a4b9cc40d.tar.gz
coinos-ui-5c37f87a58ef5d84a183cb042758a25a4b9cc40d.zip
printer page
Diffstat (limited to 'src/routes/(app)/printer/+page.server.ts')
-rw-r--r--src/routes/(app)/printer/+page.server.ts18
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())) };
+ },
+};