feat: implement edit profile feature#47
Conversation
|
Please add a description about what this pull request does and how it can be tested. |
kelue
left a comment
There was a problem hiding this comment.
The code you submitted does not solve the issue of editing profile picture. Please review the code
| const editProfile = async (req, res) => { | ||
| try { | ||
| const id = req.params.id; | ||
| const userData = await User.findById({userId: id}); |
There was a problem hiding this comment.
user models does not have this find by id method you are trying to call here. Did you test this to see that it works
|
|
||
|
|
||
|
|
||
| const editProfile = async (req, res) => { |
There was a problem hiding this comment.
(req, res, next) are the parameters for controllers
| }catch (err) { | ||
| res.status(ERROR).json({ | ||
| message: err.message | ||
| }) |
There was a problem hiding this comment.
inside catch, all you need to do is next(err)....pass error into next so that the universal error handler will take care of it
| }catch (err) { | ||
| res.status(ERROR).json({ | ||
| message: err.message | ||
| }) |
There was a problem hiding this comment.
inside catch, all you need to do is next(err)....pass error into next function so that the universal error handler will take care of it
No description provided.