feat: add logging
chore: simplify code
This commit is contained in:
parent
6985c632cd
commit
547beac19f
2 changed files with 12 additions and 6 deletions
|
|
@ -1,11 +1,15 @@
|
|||
const pairing = require('../pairing')
|
||||
const logger = require('../logger')
|
||||
|
||||
function ca (req, res) {
|
||||
const token = req.query.token
|
||||
|
||||
return pairing.authorizeCaDownload(token)
|
||||
.then(ca => res.json({ ca }))
|
||||
.catch(() => res.status(403).json({ error: 'forbidden' }))
|
||||
.catch(error => {
|
||||
logger.error(error.message)
|
||||
res.status(403).json({ error: 'forbidden' })
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = ca
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue