Advertisement
xapu

Untitled

Oct 24th, 2017
407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. let allOrdersUpdate = (req, res) => {
  2. let newState = req.body.status
  3.  
  4. Order.find({}).sort('-date').populate('product').then(orders => {
  5.  
  6. for (let elem in newState) {
  7. orders[elem].status = newState[elem]
  8. orders[elem].save()
  9. }
  10.  
  11. res.redirect('/allOrders')
  12. console.log(orders)
  13. })
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement