Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOTFIX] Handle duplicate logout token #26

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import { JwtPayload } from './strategies/accessToken.strategy';
import { FileService } from '../file/file.service';
import { UploadFileRequest, UploadFileResponse } from '../file/file.pb';
import { profile } from 'console';

Check warning on line 37 in src/auth/auth.service.ts

View workflow job for this annotation

GitHub Actions / test (18.x)

'profile' is defined but never used

@Injectable()
export class AuthService implements AuthServiceController {
Expand Down Expand Up @@ -424,15 +424,20 @@
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: 'Token is already used',
});
}
throw new RpcException({
code: status.INTERNAL,
message: e.message,
message: 'Internal server error',
});
}

Expand Down Expand Up @@ -497,7 +502,7 @@
request: UpdateUserSportAreaRequest,
): Promise<UpdateUserSportAreaResponse> {
try {
const user = await this.sportAreaListRepo.addSportArea(request);

Check warning on line 505 in src/auth/auth.service.ts

View workflow job for this annotation

GitHub Actions / test (18.x)

'user' is assigned a value but never used
return request;
} catch (err: any) {
console.log(err);
Expand Down
Loading