Add prettier to api
This commit is contained in:
@@ -11,18 +11,20 @@ module.exports = (passport) => {
|
||||
options.jwtFromRequest = ExtractJWT.fromAuthHeaderAsBearerToken();
|
||||
options.secretOrKey = process.env.tokenSecret;
|
||||
|
||||
passport.use(new StrategyJWT(options, async (jwtPayload, done) => {
|
||||
let user;
|
||||
try {
|
||||
user = await users.getById(jwtPayload.id);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return done(error, null);
|
||||
}
|
||||
passport.use(
|
||||
new StrategyJWT(options, async (jwtPayload, done) => {
|
||||
let user;
|
||||
try {
|
||||
user = await users.getById(jwtPayload.id);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return done(error, null);
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
return done(null, false);
|
||||
}
|
||||
return done(null, users.convertToPublicFormat(user));
|
||||
}));
|
||||
if (!user) {
|
||||
return done(null, false);
|
||||
}
|
||||
return done(null, users.convertToPublicFormat(user));
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user