You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
341 B
JavaScript

const User = require('../models/user')
const auth = require('../jwt-auth')
module.exports.user = (req, res) => {
let condition = {
_id: auth.getId(req.headers.authorization)
}
User.findOne(condition).exec().then((user) => {
res.status(200).json(user.orders)
}).catch((err) => {
res.status(400).json({ error: err.message })
})
}