diff options
| author | Adam Soltys <[email protected]> | 2022-07-30 11:13:39 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-07-30 11:13:39 -0700 |
| commit | 5bf4891768f1ee359ee5795272c289b40745aed5 (patch) | |
| tree | c1da5cd4b4f3219162b03c2314b518686b7c69ed /src/routes/invoice | |
| parent | 8acc59a86b6ec049dfe07f92fd19eeda726136f3 (diff) | |
| download | coinos-ui-5bf4891768f1ee359ee5795272c289b40745aed5.tar.gz coinos-ui-5bf4891768f1ee359ee5795272c289b40745aed5.zip | |
get invoice by uuid
Diffstat (limited to 'src/routes/invoice')
| -rw-r--r-- | src/routes/invoice/[amount].js | 12 | ||||
| -rw-r--r-- | src/routes/invoice/[id].js | 11 | ||||
| -rw-r--r-- | src/routes/invoice/[id].svelte (renamed from src/routes/invoice/[amount].svelte) | 0 | ||||
| -rw-r--r-- | src/routes/invoice/index.js | 11 |
4 files changed, 22 insertions, 12 deletions
diff --git a/src/routes/invoice/[amount].js b/src/routes/invoice/[amount].js deleted file mode 100644 index 9e9678a6..00000000 --- a/src/routes/invoice/[amount].js +++ /dev/null @@ -1,12 +0,0 @@ -import { post } from '$lib/utils'; - -const username = 'bob', - network = 'lightning'; - -export async function GET({ params }) { - let { amount } = params; - let { text } = await post('/lightning/invoice', { amount }); - await post('/invoice', { invoice: { text, network }, user: { username } }); - - return { body: { amount, text } }; -} diff --git a/src/routes/invoice/[id].js b/src/routes/invoice/[id].js new file mode 100644 index 00000000..37ef098d --- /dev/null +++ b/src/routes/invoice/[id].js @@ -0,0 +1,11 @@ +import { get } from '$lib/utils'; + +const username = 'bob', + network = 'lightning'; + +export async function GET({ params }) { + let { id } = params; + let { amount, text } = await get(`/invoice?uuid=${id}`); + + return { body: { amount, text } }; +} diff --git a/src/routes/invoice/[amount].svelte b/src/routes/invoice/[id].svelte index d1dea907..d1dea907 100644 --- a/src/routes/invoice/[amount].svelte +++ b/src/routes/invoice/[id].svelte diff --git a/src/routes/invoice/index.js b/src/routes/invoice/index.js new file mode 100644 index 00000000..26bffd37 --- /dev/null +++ b/src/routes/invoice/index.js @@ -0,0 +1,11 @@ +import { post } from '$lib/utils'; + +let network = 'lightning'; + +export async function POST({ request }) { + let { amount, username } = await request.json(); + let { text } = await post('/lightning/invoice', ); + let { uuid: id } = await post('/invoice', { invoice: { text, network }, user: { username } }); + + return { body: { id } }; +} |
