blob: dfa41a1746ebec5c2134f3ff9f1acd59ca6a18a5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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}`);
},
};
|