diff options
Diffstat (limited to 'routes/invoices.ts')
| -rw-r--r-- | routes/invoices.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/routes/invoices.ts b/routes/invoices.ts index 0881c69f..ecac713c 100644 --- a/routes/invoices.ts +++ b/routes/invoices.ts @@ -24,11 +24,14 @@ export default { async create(req, res) { let { body, user } = req; - if (body.user) user = body.user; const { invoice } = body; + if (body.user) user = body.user; + if (req.user.username === user.username) invoice.own = true; + try { - res.send(await generate({ invoice, user })); + const result = await generate({ invoice, user }); + res.send(result); } catch (e) { err( "problem generating invoice", |
