aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/send/well/+page.server.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-09-06 09:31:54 -0700
committerAdam Soltys <[email protected]>2024-09-06 09:31:54 -0700
commit5135216f5475aa8a0b6badb5feaae2c3b14e625a (patch)
tree5c6cbc0151b0f469b4d6a90dc0b9afa6fb3cc2d4 /src/routes/(app)/send/well/+page.server.ts
parente2996ef8d1d3628731e340481d01a5ef07e2abd1 (diff)
downloadcoinos-ui-well.tar.gz
coinos-ui-well.zip
send wellwell
Diffstat (limited to 'src/routes/(app)/send/well/+page.server.ts')
-rw-r--r--src/routes/(app)/send/well/+page.server.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/routes/(app)/send/well/+page.server.ts b/src/routes/(app)/send/well/+page.server.ts
new file mode 100644
index 00000000..dfa41a17
--- /dev/null
+++ b/src/routes/(app)/send/well/+page.server.ts
@@ -0,0 +1,27 @@
+import { error, redirect } from "@sveltejs/kit";
+import { auth, post, fd } from "$lib/utils";
+
+export let load = async ({ fetch }) => {
+ let wellrates = await fetch("https://bitcoinwell.com/api/rate/public").then(
+ (r) => r.json()
+ );
+ console.log(wellrates);
+
+ return { wellrates };
+};
+
+export const actions = {
+ default: async ({ cookies, request }) => {
+ let id;
+ let body = await fd(request);
+
+ try {
+ ({ id } = await post("/mint", body, auth(cookies)));
+ } catch (e: any) {
+ console.log("problem creating ecash", e);
+ error(400, { message: e.message });
+ }
+
+ redirect(307, `/ecash/${id}`);
+ },
+};