Last active
April 14, 2019 12:49
-
-
Save tamunoibi/df635bc5d13d7d2b235e11f3798114af to your computer and use it in GitHub Desktop.
@account @delete
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Deleting | |
| const { accountId } = req.params; | |
| const account = accounts.find(singleAccount => singleAccount.accountId === accountId); | |
| // Handle cases where account with such an accountId is not found | |
| if (!account) { | |
| return res.status(400).json({ | |
| status: 'error', | |
| message: 'No account with the given email', | |
| }); | |
| } | |
| // Handle cases where the account is in existence | |
| user.remove({ accountNumber } ); // Confirm this part, remove() is not a function | |
| return res.status(204).json({ | |
| status: 'success', | |
| account, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment