Skip to content

Commit

Permalink
handle duplicate token when logout
Browse files Browse the repository at this point in the history
  • Loading branch information
Nitiwat-owen committed Nov 14, 2023
1 parent 5837e9f commit 818ff68
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,20 @@ export class AuthService implements AuthServiceController {
await this.userRepo.update(userId, {
refreshToken: null,
});
} catch (e) {
if (e instanceof Prisma.PrismaClientKnownRequestError) {
} catch (error) {
console.log(error);
if (error instanceof Prisma.PrismaClientKnownRequestError) {
console.log(
'There is a unique constraint violation, a blacklist should not outdated twice!',
);
throw new RpcException({
code: status.ALREADY_EXISTS,
message: error.message,
});
}
throw new RpcException({
code: status.INTERNAL,
message: e.message,
message: error.message,
});
}

Expand Down

0 comments on commit 818ff68

Please sign in to comment.