Skip to content

Commit

Permalink
update admin api fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SwayamRana808 committed May 20, 2024
1 parent b3d4161 commit af09ca2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 4 additions & 3 deletions backend/app/routes/admin/updateAdmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports =async (req, res) => {
}

try {
let updateFields = {
const updateFields = {
firstName:req.body.firstName,
lastName:req.body.lastName,
contact:req.body.contact,
Expand All @@ -33,9 +33,10 @@ module.exports =async (req, res) => {
{ $set: updateFields },
{ new: true }
);
res.status(200).json({"Req.Body":updateFields});
return res.status(200).json({"Req.Body":updateFields,"updatedDoc":updatedAdmin});
} catch (err) {
res.status(500).json(err);
return res.status(500).json(err);
}

res.send('Done');
};
2 changes: 0 additions & 2 deletions frontend/src/pages/Admin/Components/Profile/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ export function Profile(props) {
contact:phone,
};
const formData = new FormData();

// Append form fields to FormData
formData.append('firstName', firstName);
formData.append('lastName', lastName);
formData.append('username', username);
Expand Down

0 comments on commit af09ca2

Please sign in to comment.