Pretty things up a bit, after fixing that nasty profile bug.

This commit is contained in:
rainbow napkin 2025-11-06 19:36:52 -05:00
parent be01417cdf
commit e94914a152
2 changed files with 10 additions and 8 deletions

View file

@ -46,6 +46,12 @@ module.exports.post = async function(req, res){
const {field, change} = data;
const {user} = req.session;
//If the user is null
if(user == null || user.user == null){
//BEFORE YOU BREAK MY HEART!!!
return errorHandler(res, 'You must be logged in to preform this action!', 'unauthorized');
}
const userDB = await userModel.findOne({user: user.user});
const update = {};
@ -86,8 +92,7 @@ module.exports.post = async function(req, res){
res.status(200);
return res.send(update);
}else{
res.status(400);
return res.send({errors: [{msg:"User not found!"}]});
return errorHandler(res, 'User not found!', 'unauthorized');
}
}else{
res.status(400);