Skip to content

Commit

Permalink
refactor(#10): 네이버 로그아웃 명세서 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoDora committed Oct 12, 2023
1 parent 596d285 commit c0dbc37
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/auth/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,13 @@ export class AuthController {
return await this.authService.kakaoUnlink(kakaoAccessToken);
}

@ApiOperation({ summary: '네이버 로그아웃 API', description: '네이버 로그아웃 API' })
@ApiResponse({ status: 201, description: '성공적으로 로그아웃 된 경우', content: { JSON: { example: { message: "토큰 삭제 성공." } } } })
@ApiResponse({ status: 403, description: '만료된 액세스 토큰인 경우', content: { JSON: { example: { statusCode: 403, message: '만료된 토큰입니다.' } } } })
@ApiResponse({ status: 404, description: 'DB에서 토큰을 찾을 수 없는 경우', content: { JSON: { example: { statusCode: 404, message: '토큰을 찾을 수 없습니다.' } } } })
@Post('naver/logout')
async naverLogout(@Headers('access_token') accessToken: string) {
const userId = await this.tokenService.decodeToken(accessToken);

return await this.tokenService.deleteTokens(userId);
}

Expand Down
5 changes: 2 additions & 3 deletions src/auth/services/token.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,9 @@ export class TokenService {
try {
await this.tokenRepository.deleteTokens(userId);

return { status: true, message: '토큰 삭제 성공' };
return { message: '토큰 삭제 성공' };
} catch (error) {
console.error('토큰 삭제 오류:', error);
return { status: false, message: '토큰 삭제 실패' };
throw new HttpException('토큰을 찾을 수 없습니다.', HttpStatus.NOT_FOUND);
}
}

Expand Down

0 comments on commit c0dbc37

Please sign in to comment.