Refactor. Responses should return error string in object key message not error.
This commit is contained in:
		| @@ -6,7 +6,7 @@ const mustBeAdmin = (req, res, next) => { | ||||
|    if (req.loggedInUser === undefined) { | ||||
|       return res.status(401).send({ | ||||
|          success: false, | ||||
|          error: 'You must be logged in.', | ||||
|          message: 'You must be logged in.', | ||||
|       }); | ||||
|    } else { | ||||
|       database.get(`SELECT admin FROM user WHERE user_name IS ?`, req.loggedInUser.username) | ||||
| @@ -15,7 +15,7 @@ const mustBeAdmin = (req, res, next) => { | ||||
|          if (isAdmin.admin == 0) { | ||||
|             return res.status(401).send({ | ||||
|                success: false, | ||||
|                error: 'You must be logged in as a admin.' | ||||
|                message: 'You must be logged in as a admin.' | ||||
|             }) | ||||
|          } | ||||
|       }) | ||||
|   | ||||
| @@ -2,7 +2,7 @@ const mustBeAuthenticated = (req, res, next) => { | ||||
|    if (req.loggedInUser === undefined) { | ||||
|       return res.status(401).send({ | ||||
|          success: false, | ||||
|          error: 'You must be logged in.', | ||||
|          message: 'You must be logged in.', | ||||
|       }); | ||||
|    } | ||||
|    return next(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user