fix phoneCode bug

This commit is contained in:
Josh Harvey 2017-09-08 15:38:31 +03:00
parent 34a44c6691
commit 08bd7da33f

View file

@ -149,7 +149,8 @@ function getCustomerWithPhoneCode (req, res, next) {
const phone = req.body.phone
return pi.getPhoneCode(phone)
.then(code => {
return customers.get(phone.phone).then(customer => {
return customers.get(phone)
.then(customer => {
if (customer) return respond(req, res, {code, customer})
return customers.add(req.body)
.then(customer => respond(req, res, {code, customer}))