diff options
| author | Adam Soltys <[email protected]> | 2022-10-06 00:28:42 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-10-06 00:28:47 -0700 |
| commit | 97948ce65ec1ea90c17ef8813929cbd12b0c4bfc (patch) | |
| tree | 0b3be65703e4e17d0c41d894bd530ef63d8a4057 | |
| parent | bf70219a4753d31a201ffc10e0c378a512adb721 (diff) | |
| download | coinos-ui-97948ce65ec1ea90c17ef8813929cbd12b0c4bfc.tar.gz coinos-ui-97948ce65ec1ea90c17ef8813929cbd12b0c4bfc.zip | |
check for internal payments
| -rw-r--r-- | src/routes/send/[...text]/+page.server.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/routes/send/[...text]/+page.server.js b/src/routes/send/[...text]/+page.server.js index ec764882..471724e4 100644 --- a/src/routes/send/[...text]/+page.server.js +++ b/src/routes/send/[...text]/+page.server.js @@ -8,7 +8,14 @@ let parse = async (t) => { // lightning if (t.startsWith('ln')) { - throw redirect(303, `/send/lightning/${t}`); + let user; + try { + ({ user } = await get(`/invoice/${t}`)); + } catch (e) { + throw redirect(303, `/send/lightning/${t}`); + } + + if (user) throw redirect(303, `/send/user/${user.username}`); } // bitcoin @@ -41,8 +48,8 @@ let parse = async (t) => { }; export async function load({ params }) { - let { text } = params; - await parse(text); + let { text } = params; + await parse(text); } export const actions = { |
