From a0170af9e15405396c09d54bc53a7e82e2fb9169 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 8 Feb 2023 10:52:55 -0800 Subject: handle classic payments better --- src/routes/(app)/send/[...text]/+page.server.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/routes/(app)/send') diff --git a/src/routes/(app)/send/[...text]/+page.server.js b/src/routes/(app)/send/[...text]/+page.server.js index 096c60e9..4c2776f5 100644 --- a/src/routes/(app)/send/[...text]/+page.server.js +++ b/src/routes/(app)/send/[...text]/+page.server.js @@ -23,7 +23,7 @@ let parse = async (t, host) => { if (t.endsWith('@classic')) { ({ uuid: id } = await get(`/invoice/classic/${t.replace('@classic', '')}`)); - if (id) throw redirect(307, `/send/${id}`); + if (id) throw redirect(307, `/send/invoice/${id}`); } if (t.includes('/pot')) throw redirect(307, t.substring(t.indexOf('/pot'))); @@ -58,17 +58,29 @@ let parse = async (t, host) => { // user try { user = await get(`/users/${t}`); - if (user.anon) user = null; + if (user.anon) user = null; } catch (e) {} if (user) throw redirect(307, `/send/user/${t}`); + // pot let pot; try { pot = await get(`/pot/${t}`); - } catch (e) {} + console.log(pot); + } catch (e) { + } if (pot) throw redirect(307, `/send/pot/${t}`); + + // invoice + let invoice; + try { + invoice = await get(`/invoice/${t}`); + } catch (e) { + } + + if (invoice) throw redirect(307, `/send/invoice/${invoice.hash}`); }; export async function load({ cookies, params, request, url }) { -- cgit v1.2.3