refactor routes
This commit is contained in:
parent
1df6fe6ed1
commit
380f47082e
1 changed files with 5 additions and 3 deletions
|
|
@ -212,11 +212,13 @@ function pair (req, res) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function phoneCode (req, res) {
|
function phoneCode (req, res) {
|
||||||
|
console.log('DEBUG10')
|
||||||
var phone = req.body.phone
|
var phone = req.body.phone
|
||||||
|
|
||||||
return plugins.getPhoneCode(phone)
|
return plugins.getPhoneCode(phone)
|
||||||
.then(code => res.json({code: code}))
|
.then(code => res.json({code: code}))
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
logger.error(err)
|
||||||
if (err.name === 'BadNumberError') return res.send(410)
|
if (err.name === 'BadNumberError') return res.send(410)
|
||||||
return res.send(500)
|
return res.send(500)
|
||||||
})
|
})
|
||||||
|
|
@ -288,9 +290,9 @@ function init (localConfig) {
|
||||||
app.post('/pair', pair)
|
app.post('/pair', pair)
|
||||||
|
|
||||||
app.post('/phone_code', authMiddleware, phoneCode)
|
app.post('/phone_code', authMiddleware, phoneCode)
|
||||||
app.post('/update-phone', authMiddleware, updatePhone)
|
app.post('/update_phone', authMiddleware, updatePhone)
|
||||||
app.get('/phone-tx', authMiddleware, fetchPhoneTx)
|
app.get('/phone_tx', authMiddleware, fetchPhoneTx)
|
||||||
app.get('/await-dispense', authMiddleware, waitForDispense)
|
app.get('/await_dispense', authMiddleware, waitForDispense)
|
||||||
app.post('/dispense', authMiddleware, dispense)
|
app.post('/dispense', authMiddleware, dispense)
|
||||||
|
|
||||||
localApp.get('/pid', function (req, res) {
|
localApp.get('/pid', function (req, res) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue