diff options
| author | Adam Soltys <[email protected]> | 2020-07-28 20:16:58 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-07-28 20:25:16 -0700 |
| commit | d22869941ec704edd17d1d05038e6139681f97cf (patch) | |
| tree | cfe600fead05c7e78dec6932c62d42171251eac8 /routes/invoices.js | |
| parent | 72f3bc93357e74b71be0e3f1e621fb556f7fd088 (diff) | |
| download | coinos-server-d22869941ec704edd17d1d05038e6139681f97cf.tar.gz coinos-server-d22869941ec704edd17d1d05038e6139681f97cf.zip | |
use async handler to catch async errors
Diffstat (limited to 'routes/invoices.js')
| -rw-r--r-- | routes/invoices.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/routes/invoices.js b/routes/invoices.js index a4a6c0da..fdfb39d8 100644 --- a/routes/invoices.js +++ b/routes/invoices.js @@ -1,6 +1,6 @@ const { Op } = require("sequelize"); -app.get("/invoice", auth, async (req, res) => { +app.get("/invoice", auth, ah(async (req, res, next) => { try { const invoice = await db.Invoice.findOne({ where: { @@ -12,9 +12,9 @@ app.get("/invoice", auth, async (req, res) => { } catch (e) { l.error("couldn't find invoice", e); } -}); +})); -app.post("/invoice", auth, async (req, res) => { +app.post("/invoice", auth, ah(async (req, res, next) => { const { invoice } = req.body; invoice.user_id = req.user.id; @@ -47,4 +47,4 @@ app.post("/invoice", auth, async (req, res) => { res.send( exists ? await exists.update(invoice) : await db.Invoice.create(invoice) ); -}); +})); |
