fix: bug #1
This commit is contained in:
@@ -38,7 +38,7 @@ const authorize = async (
|
||||
module.exports = {
|
||||
SuperAdminCheck: async (req, res, next) => {
|
||||
const SuperAdmin = await UserRole.findOne({ name: SUPER_ADMIN_ROLE });
|
||||
if (authorize(req.locals.user, [SuperAdmin.id])) {
|
||||
if (authorize(res.locals.user, [SuperAdmin.id])) {
|
||||
next();
|
||||
} else {
|
||||
res
|
||||
@@ -50,7 +50,7 @@ module.exports = {
|
||||
try {
|
||||
const token = req.headers.authorization || "";
|
||||
if (token) {
|
||||
const user = authenticate(token);
|
||||
const user = await authenticate(token);
|
||||
res.locals.user = user;
|
||||
next();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user