From f5eaf3eac19e0e2902b894effb14b58cc8c21d2d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 11 Mar 2023 17:47:15 -0800 Subject: fix param name --- src/routes/(app)/[username]/invoice/+server.js | 6 ++++-- .../(app)/[username]/invoice/[hash]/tip/+page.svelte | 4 ++++ src/routes/(app)/send/invoice/[id]/+page.server.js | 17 +++++++++++++---- src/routes/(app)/sent/+page.server.js | 1 - 4 files changed, 21 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/routes/(app)/[username]/invoice/+server.js b/src/routes/(app)/[username]/invoice/+server.js index 1321739e..461d380c 100644 --- a/src/routes/(app)/[username]/invoice/+server.js +++ b/src/routes/(app)/[username]/invoice/+server.js @@ -1,5 +1,7 @@ import { auth, post } from '$lib/utils'; import { json } from '@sveltejs/kit'; -export let POST = async ({ cookies: c, request: r }) => - json(await post('/invoice', await r.json(), auth(c))); +export let POST = async ({ cookies: c, request: r }) => { + let j = await r.json(); + return json(await post('/invoice', j, auth(c))); +}; diff --git a/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte b/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte index 296ef9c6..9d9021a6 100644 --- a/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte +++ b/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte @@ -59,6 +59,7 @@ let { invoice, id, user } = data; let { amount, + hash, type, rate, received, @@ -79,6 +80,7 @@ ({ invoice, id } = data); ({ amount, + hash, type, rate, received, @@ -110,6 +112,8 @@ + +

{$t('invoice.addTipq')}

diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.js b/src/routes/(app)/send/invoice/[id]/+page.server.js index 261345fa..c9c2b222 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.js +++ b/src/routes/(app)/send/invoice/[id]/+page.server.js @@ -4,18 +4,27 @@ import { fd, auth, get, post } from '$lib/utils'; export async function load({ params: { id }, parent, url }) { let { user } = await parent(); - let { amount, address, rate, prompt, tip, text, user: recipient } = await get(`/invoice/${id}`); + let { + amount, + address, + hash, + rate, + prompt, + tip, + text, + user: recipient + } = await get(`/invoice/${id}`); if (prompt && tip === null) throw redirect(307, `/${recipient.username}/invoice/${id}/tip`); if (recipient.username === user.username) throw error(500, { message: 'Cannot send to self' }); - return { amount, address, tip, rate, payreq: text, recipient }; + return { amount, address, hash, tip, rate, payreq: text, recipient }; } export const actions = { - default: async ({ cookies, params: { hash }, request }) => { + default: async ({ cookies, params: { id }, request }) => { try { let body = await fd(request); - body.hash = hash; + body.hash = id; await post('/payments', body, auth(cookies)); } catch (e) { diff --git a/src/routes/(app)/sent/+page.server.js b/src/routes/(app)/sent/+page.server.js index d949906a..381ff32f 100644 --- a/src/routes/(app)/sent/+page.server.js +++ b/src/routes/(app)/sent/+page.server.js @@ -2,6 +2,5 @@ import { get, auth } from '$lib/utils'; export let load = async ({ cookies }) => { let { payments } = await get('/payments', auth(cookies)); - console.log('HUH', payments[0]); return { payments }; }; -- cgit v1.2.3