diff --git a/backend/app/routes/admin/updateAdmin.js b/backend/app/routes/admin/updateAdmin.js index e7bb5096..453f7f4e 100644 --- a/backend/app/routes/admin/updateAdmin.js +++ b/backend/app/routes/admin/updateAdmin.js @@ -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, @@ -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'); }; diff --git a/frontend/src/pages/Admin/Components/Profile/Profile.jsx b/frontend/src/pages/Admin/Components/Profile/Profile.jsx index 3b615546..abfafad4 100644 --- a/frontend/src/pages/Admin/Components/Profile/Profile.jsx +++ b/frontend/src/pages/Admin/Components/Profile/Profile.jsx @@ -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);