From 1ffbf4f91c9112080bae0953ec7abe86d16a1d94 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 3 May 2023 10:45:56 -0700 Subject: display address --- src/routes/(app)/buy/+page.server.js | 6 ++++++ src/routes/(app)/buy/+page.svelte | 20 ++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'src/routes/(app)/buy') diff --git a/src/routes/(app)/buy/+page.server.js b/src/routes/(app)/buy/+page.server.js index fc7ae473..b97ac88b 100644 --- a/src/routes/(app)/buy/+page.server.js +++ b/src/routes/(app)/buy/+page.server.js @@ -3,6 +3,12 @@ import { error, fail, redirect } from '@sveltejs/kit'; import { post, auth } from '$lib/utils'; import { createTicket } from '$lib/ticket'; +export let load = async ({ cookies }) => { + let invoice = await post('/invoice', { invoice: { type: 'bitcoin' }}, auth(cookies)); + let { hash } = invoice; + return { address: hash }; +} + export const actions = { default: async ({ cookies, request }) => { let form = await request.formData(); diff --git a/src/routes/(app)/buy/+page.svelte b/src/routes/(app)/buy/+page.svelte index 05e003df..bf4d3889 100644 --- a/src/routes/(app)/buy/+page.svelte +++ b/src/routes/(app)/buy/+page.svelte @@ -1,6 +1,9 @@
@@ -10,11 +13,24 @@
+
+
Your bitcoin address
+
+
+ {address} +
+
+ +
+