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
|
|
@ -18,7 +18,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
|||
const {validationResult, matchedData} = require('express-validator');
|
||||
|
||||
//local imports
|
||||
const {exceptionHandler} = require('../../../utils/loggerUtils.js');
|
||||
const {exceptionHandler, errorHandler} = require('../../../utils/loggerUtils.js');
|
||||
const permissionModel = require('../../../schemas/permissionSchema.js');
|
||||
|
||||
//api permissions functions
|
||||
|
|
@ -76,8 +76,7 @@ module.exports.post = async function(req, res){
|
|||
|
||||
//Flip our shit if something's wrong.
|
||||
if(permError){
|
||||
res.status(401);
|
||||
return res.send({errors:[{type: "Unauthorized", msg: "New rank must be equal to or below that of the user changing it.", date: new Date()}]});
|
||||
return errorHandler(res, "New rank must be equal to or below that of the user changing it.", 'Unauthorized', 401);
|
||||
}
|
||||
|
||||
await perms.save();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue