Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. // Updating
  2.  
  3.  
  4. const { accountId } = req.params;
  5. const account = accounts.find(singleAccount => singleAccount.accountNumber === accountId);
  6.  
  7. // Handle cases where account with such an accountNumer is not found
  8. if (!account) {
  9. return res.status(400).json({
  10. status: 'error',
  11. message: 'No account with the given email',
  12. });
  13. }
  14.  
  15. // Handle cases where the account is in existence
  16. const { status } = req.body;
  17.  
  18. users.update ({ account }); // Confirm this part
  19.  
  20. return res.status(202).json({
  21. status: 'success',
  22. account,
  23. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement