I want to return true or false to a app.locals function in EJS but, it returns nothing, return is not working. Here is my code:
app.locals.isAdmin = async(uidd) => {
var check = await Admins.find({
userID: [uidd]
}).then(result => {
var result = result.toString();
if(result !== ""){
console.log("Is admin")
return true;
}else{
console.log("Is not admin")
return false;
}
})
};