const JwtStrategy = require('passport-jwt').Strategy
const mongoose = require('mongoose')
const keys = require('../config/keys')
const User = mongoose.model('users')
const ExtractJwt = require('passport-jwt').ExtractJwt
const options = {
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
secretOrKeys: keys.jwt
}
module.exports = passport => {
passport.use(
new JwtStrategy(options, async (payload, done) => {
try {
const user = await User.findById(payload.userId).select('email id')
if (user) {
done(null, user)
} else {
done(null, false)
}
} catch {
console.log(e)
}
})
)
}
консоль ругается выдает ошибку