mirror of
https://github.com/hexastack/hexabot
synced 2025-01-22 10:35:37 +00:00
fix: adapt passport logic
This commit is contained in:
parent
88cb281694
commit
cc2f5a1665
@ -19,7 +19,10 @@ export class AuthSerializer extends PassportSerializer {
|
||||
super();
|
||||
}
|
||||
|
||||
serializeUser(user: User, done: (err: Error, user: SessionUser) => void) {
|
||||
serializeUser(
|
||||
user: User,
|
||||
done: (err: Error | null, user: SessionUser) => void,
|
||||
) {
|
||||
done(null, {
|
||||
id: user.id,
|
||||
first_name: user.first_name,
|
||||
@ -29,9 +32,9 @@ export class AuthSerializer extends PassportSerializer {
|
||||
|
||||
async deserializeUser(
|
||||
payload: SessionUser,
|
||||
done: (err: Error, user: SessionUser) => void,
|
||||
done: (err: Error | null, user: SessionUser | null) => void,
|
||||
) {
|
||||
const user = await this.userService.findOne(payload.id);
|
||||
const user = payload.id ? await this.userService.findOne(payload.id) : null;
|
||||
user ? done(null, user) : done(null, null);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user