diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/invoice.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/invoice.js b/src/lib/invoice.js index 6ec7d41b..9e71f905 100644 --- a/src/lib/invoice.js +++ b/src/lib/invoice.js @@ -1,7 +1,7 @@ import { auth, get, post } from '$lib/utils'; import { redirect } from '@sveltejs/kit'; -export default async ({ cookies, request }) => { +export default async ({ cookies, request, url }) => { let form = await request.formData(); let rates = await get('/rates'); @@ -21,7 +21,11 @@ export default async ({ cookies, request }) => { let { uuid } = await post('/invoice', { invoice, user }, auth(cookies)); - if (request_id) throw redirect(307, `/${user.username}/request/${request_id}`); + if (request_id) { + if (url.pathname.endsWith('tip')) + throw redirect(307, `/send/${uuid}`); + throw redirect(307, `/${user.username}/request/${request_id}`); + } if (invoice.prompt) { throw redirect(307, `/invoice/${uuid}/tip`); |
