1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import { auth, fd, post, types } from "$lib/utils";
import { redirect } from "@sveltejs/kit";
export async function load({ cookies, parent, url }) {
const { user } = await parent();
if (!user) redirect(307, `/register?redirect=${url.pathname}`);
const invoice = {
address_type: "legacy",
type: types.bitcoin,
};
const { text: address } = await post("/invoice", { invoice }, auth(cookies));
return { address };
}
export const actions = {
default: async ({ cookies, request }) => {
const body = await fd(request);
return post("/sign", body, auth(cookies));
},
};
|