From ca5152d911559ea59a071922bfe950d8e4f81bc2 Mon Sep 17 00:00:00 2001 From: born-A <93516595+born-A@users.noreply.github.com> Date: Tue, 7 Nov 2023 19:05:33 +0900 Subject: [PATCH] =?UTF-8?q?NO-JIRA-refactor=20:=20response=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nabimarketbe/oauth2/kakao/api/OAuth2Controller.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/prgrms/nabimarketbe/oauth2/kakao/api/OAuth2Controller.java b/src/main/java/org/prgrms/nabimarketbe/oauth2/kakao/api/OAuth2Controller.java index 58df02f3..8976e09b 100644 --- a/src/main/java/org/prgrms/nabimarketbe/oauth2/kakao/api/OAuth2Controller.java +++ b/src/main/java/org/prgrms/nabimarketbe/oauth2/kakao/api/OAuth2Controller.java @@ -8,6 +8,7 @@ import org.prgrms.nabimarketbe.domain.user.service.SignService; import org.prgrms.nabimarketbe.global.util.ResponseFactory; import org.prgrms.nabimarketbe.global.util.model.CommonResult; +import org.prgrms.nabimarketbe.global.util.model.SingleResult; import org.prgrms.nabimarketbe.oauth2.kakao.dto.KakaoProfile; import org.prgrms.nabimarketbe.oauth2.kakao.service.OAuth2Service; import org.springframework.core.env.Environment; @@ -39,11 +40,13 @@ public void socialLogin(HttpServletResponse response) throws IOException { } @GetMapping(value = "/redirect") - public UserLoginResponseDTO redirectKakao(@RequestParam String code) { + public ResponseEntity> redirectKakao(@RequestParam String code) { KakaoProfile profile = OAuth2Service.getResultProfile(code); if (profile == null) throw new RuntimeException("카카오에 해당 회원이 없습니다."); + UserLoginResponseDTO userLoginResponseDTO = signService.signInBySocial(profile); + SingleResult response = ResponseFactory.getSingleResult(userLoginResponseDTO); - return signService.signInBySocial(profile); + return ResponseEntity.ok(response); } //TODO : 사용자가 accessToken 넘기는건 아닌거 같음