From 67c4af186fec0423664b18847921eb9696a1eeef Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 18 Jan 2023 19:44:27 -0800 Subject: pots --- src/lib/invoice.js | 8 ++++---- src/lib/socket.js | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src/lib') diff --git a/src/lib/invoice.js b/src/lib/invoice.js index c81b4061..fa29130e 100644 --- a/src/lib/invoice.js +++ b/src/lib/invoice.js @@ -19,19 +19,19 @@ export default async ({ cookies, request, url }) => { let user = { username: form.get('username'), currency: form.get('currency') }; - let { id } = await post('/invoice', { invoice, user }, auth(cookies)); + let { hash } = await post('/invoice', { invoice, user }, auth(cookies)); if (request_id) { if (url.pathname.endsWith('tip')) { - throw redirect(307, `/send/${id}`); + throw redirect(307, `/send/${hash}`); } throw redirect(307, `/${user.username}/request/${request_id}`); } if (invoice.prompt) { - throw redirect(307, `/invoice/${id}/tip`); + throw redirect(307, `/invoice/${hash}/tip`); } else { - throw redirect(307, `/invoice/${id}`); + throw redirect(307, `/invoice/${hash}`); } }; diff --git a/src/lib/socket.js b/src/lib/socket.js index 755c87e4..86083974 100644 --- a/src/lib/socket.js +++ b/src/lib/socket.js @@ -58,8 +58,7 @@ export const messages = (data) => ({ async payment() { let { amount, invoice } = data; - - if (invoice) invalidate('app:invoice'); + invalidate('app:invoice'); let payments = get(txns); let i = payments.findIndex((p) => p.id === data.id); @@ -118,5 +117,5 @@ function reconnectToWebsocket() { if (currentReconnectDelay < maxReconnectDelay) { currentReconnectDelay *= 2; } - connect(); + connect(token); } -- cgit v1.2.3