fix: refresh token invalidate for logout
This commit is contained in:
@@ -125,9 +125,8 @@ export class TokensService {
|
||||
}
|
||||
/************************************************************ */
|
||||
|
||||
async invalidateRefreshToken(oldRefreshToken: string) {
|
||||
const token = await this.refreshTokensRepository.findOne({ where: { token: oldRefreshToken }, relations: { user: true } });
|
||||
|
||||
if (token) await this.refreshTokensRepository.delete({ id: token.id });
|
||||
async invalidateRefreshToken(userId: string) {
|
||||
await this.refreshTokensRepository.delete({ user: { id: userId } });
|
||||
this.logger.log(`Successfully deleted all refresh tokens for user ${userId}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user