Skip to content

feat: implement edit profile feature#47

Open
olaobey wants to merge 1 commit into
devfrom
ft-edit-profile
Open

feat: implement edit profile feature#47
olaobey wants to merge 1 commit into
devfrom
ft-edit-profile

Conversation

@olaobey

@olaobey olaobey commented Dec 5, 2022

Copy link
Copy Markdown

No description provided.

@olaobey olaobey requested a review from kelue December 5, 2022 21:16
@bright258

Copy link
Copy Markdown
Contributor

Please add a description about what this pull request does and how it can be tested.

@kelue kelue left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(req, res, next) are the parameters for controllers

}catch (err) {
res.status(ERROR).json({
message: err.message
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants