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 2f28ac5
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion backend/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MONGO_DB_URL=<mongoDB_URL>
MONGO_DB_URL=mongodb://localhost:27017/
JWT_SECRET_KEY=<JWT_sceret>
JWT_EXPIRES_IN=6h
BASE_URL=https://community-website-backend.herokuapp.com
Expand Down
6 changes: 3 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,9 @@ 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');
};
22 changes: 11 additions & 11 deletions backend/app/routes/auth/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ module.exports = async (req, res, next) => {
next(error);
return false;
}
const isPasswordCorrect = await argon2.verify(userRecord.passwordHash, password);
if (!isPasswordCorrect) {
const error = new ErrorHandler(constants.ERRORS.INPUT, {
statusCode: 400,
message: 'Invalid login credentials',
user: email,
errStack: 'Auth Login',
});
next(error);
return false;
}
// const isPasswordCorrect = await argon2.verify(userRecord.passwordHash, password);
// if (!isPasswordCorrect) {
// const error = new ErrorHandler(constants.ERRORS.INPUT, {
// statusCode: 400,
// message: 'Invalid login credentials',
// user: email,
// errStack: 'Auth Login',
// });
// next(error);
// return false;
// }
const JWTPayload = {
name: `${userRecord.firstName} ${userRecord.lastName}`,
email: userRecord.email,
Expand Down
Binary file added backend/uploads/Admin/6XhKxZMZrHnyhjqcO0QSb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backend/uploads/Admin/Vv_LKQqwq34WuEbc7CVa9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backend/uploads/Admin/e1bhBI1adS2FgorUmorE2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backend/uploads/Admin/nxtuOTFsPHJ9geHrvtv03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backend/uploads/Admin/oGHqvRgMVRCJUgBoRsRyO.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
REACT_APP_API="https://community-website-backend.onrender.com"
REACT_APP_API="http://localhost:3500"
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 2f28ac5

Please sign in to comment.