From 5e4bb408528e01d6878f1947356fa10e2e50ae2d Mon Sep 17 00:00:00 2001 From: hysong4u Date: Fri, 19 Apr 2024 00:44:22 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20=EA=B5=AC=EA=B8=80=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20response=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/user/controller/OauthController.java | 13 ++++++++----- .../domain/user/dto/response/LoginResponseDto.java | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/example/comma/domain/user/controller/OauthController.java b/src/main/java/com/example/comma/domain/user/controller/OauthController.java index 487bdfa..27769ee 100644 --- a/src/main/java/com/example/comma/domain/user/controller/OauthController.java +++ b/src/main/java/com/example/comma/domain/user/controller/OauthController.java @@ -32,12 +32,15 @@ ResponseEntity> googleLogin(@RequestParam (name = "code") Str User user = userRepository.findById(userId).orElseThrow(() -> new EntityNotFoundException(ErrorCode.USER_NOT_FOUND)); String nickname = user.getNickname(); - if (nickname == null) { - nickname = userService.generateNickname(); + if (nickname == null) { // + nickname = UserService.generateNickname(); + LoginResponseDto response = new LoginResponseDto(accessToken, nickname,true); + return SuccessResponse.ok(response); + } + else{ + LoginResponseDto response = new LoginResponseDto(accessToken, nickname,false); + return SuccessResponse.ok(response); } - - LoginResponseDto response = new LoginResponseDto(accessToken, nickname); - return SuccessResponse.ok(response); } diff --git a/src/main/java/com/example/comma/domain/user/dto/response/LoginResponseDto.java b/src/main/java/com/example/comma/domain/user/dto/response/LoginResponseDto.java index b108b06..478695a 100644 --- a/src/main/java/com/example/comma/domain/user/dto/response/LoginResponseDto.java +++ b/src/main/java/com/example/comma/domain/user/dto/response/LoginResponseDto.java @@ -2,6 +2,7 @@ public record LoginResponseDto( String accessToken, - String nickname + String nickname, + Boolean isNew ) { }