You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also, when we hit 'GET /api/v1/citizen/profile/:id'
the id parameter in the req will course a lot of problems, its suppose to be a the citizen._id right?
but i can't get the citizen details until this code runs const citizen = await Citizens.findOne({ _id: req.params.id });
And that code only runs on a GET request to /api/v1/citizen/profile/:id which requires a param of the citizen id,whc i dont have yet
so i suggest you change the controller url from /api/v1/citizen/profile/:id to /api/v1/citizen/profile
And const citizen = await Citizens.findOne({ _id: req.params.id });
to something like : const citizen= await Citizens.findById(req.user, '-password'); res.json({ citizen});
Also, when we hit 'GET /api/v1/citizen/profile/:id'
the id parameter in the req will course a lot of problems, its suppose to be a the citizen._id right?
but i can't get the citizen details until this code runs
const citizen = await Citizens.findOne({ _id: req.params.id });
And that code only runs on a GET request to
/api/v1/citizen/profile/:id
which requires a param of the citizen id,whc i dont have yetso i suggest you change the controller url from
/api/v1/citizen/profile/:id
to/api/v1/citizen/profile
And
const citizen = await Citizens.findOne({ _id: req.params.id });
to something like :
const citizen= await Citizens.findById(req.user, '-password'); res.json({ citizen});
Originally posted by @sleekLancelot in #13 (comment)
The text was updated successfully, but these errors were encountered: