Add *override_by fields in customer

This commit is contained in:
goga-m 2017-09-28 16:03:49 +03:00 committed by Josh Harvey
parent e351d1b495
commit 89eb617a4a
3 changed files with 39 additions and 3 deletions

View file

@ -194,7 +194,8 @@ app.get('/api/customer/:id', (req, res, next) => {
*/
app.patch('/api/customer/:id', (req, res, next) => {
if (!req.params.id) return res.status(400).send({Error: 'Requires id'})
return customers.update(req.params.id, req.query)
const token = req.token || req.cookies.token
return customers.update(req.params.id, req.query, token)
.then(r => res.send(r))
.catch(() => res.status(404).send({Error: 'Not found'}))
})