Added tokeCommand delete endpoint and ajax call, replaced all raw error responses.
This commit is contained in:
parent
af7f4219a5
commit
864304f13b
28 changed files with 93 additions and 64 deletions
|
|
@ -225,8 +225,7 @@ channelSchema.statics.reqPermCheck = function(perm, chanField = "chanName"){
|
|||
next();
|
||||
}else{
|
||||
//If not, prevent the request from going through and tell them why
|
||||
res.status(401);
|
||||
return res.send({errors:[{type: "Unauthorized", msg: "You do not have a high enough rank to access this resource.", date: new Date()}]});
|
||||
return errorHandler(res, "You do not have a high enough rank to access this resource.", 'Unauthorized', 401);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -155,8 +155,7 @@ permissionSchema.statics.reqPermCheck = function(perm){
|
|||
if(await permissionSchema.statics.permCheck(req.session.user, perm)){
|
||||
next();
|
||||
}else{
|
||||
res.status(401);
|
||||
return res.send({errors:[{type: "Unauthorized", msg: "You do not have a high enough rank to access this resource.", date: new Date()}]});
|
||||
return errorHandler(res, "You do not have a high enough rank to access this resource.", 'Unauthorized', 401);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue