Skip to content

Commit

Permalink
hotfix: ResponseEntity.BodyBuilder 선언 및 오타 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
yo0oni committed Jan 27, 2024
1 parent c968c00 commit a602c76
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 22 deletions.
Empty file.
Empty file.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions .idea/sonarlint/issuestore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
Empty file.
4 changes: 0 additions & 4 deletions .idea/sonarlint/securityhotspotstore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
import com.isp.backend.domain.member.dto.SignUpRequest;
import com.isp.backend.domain.member.service.MemberService;
import com.isp.backend.global.security.CustomUserDetails;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
Expand All @@ -31,7 +28,7 @@ public String testEndpoint() {
* 로그인 API
*/
@PostMapping("/login")
public ResponseEntity<String> memberLogin(@RequestBody GoogleLoginRequest request) {
public ResponseEntity.BodyBuilder memberLogin(@RequestBody GoogleLoginRequest request) {
return memberService.memberLogin(request);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,22 @@ public class MemberService {
* 로그인 메서드 - jwt 토큰 생성후 응답
*/
@Transactional
public ResponseEntity<String> memberLogin(GoogleLoginRequest request) {
public ResponseEntity.BodyBuilder memberLogin(GoogleLoginRequest request) {
Optional<Member> existingMember = memberRepository.findByUid(request.getUid());

if (existingMember.isPresent()) {

Member activatedMemeber = existingMember
Member activatedMember = existingMember
.filter(Member::isActivated)
.orElseThrow(MemberNotActivatedException::new);

// 기존 회원의 로그인
String accessToken = tokenProvider.createAccessToken(activatedMemeber.getUid());
String refreshToken = tokenProvider.createRefreshToken(activatedMemeber.getUid());
String accessToken = tokenProvider.createAccessToken(activatedMember.getUid());
String refreshToken = tokenProvider.createRefreshToken(activatedMember.getUid());

return ResponseEntity.ok()
.header("Access-Token", accessToken)
.header("Refresh-Token", refreshToken)
.body("기존 멤버 로그인");
.header("Refresh-Token", refreshToken);
} else {
// 신규 회원의 로그인 - db 저장
Member newMember = Member.builder()
Expand All @@ -62,8 +61,7 @@ public ResponseEntity<String> memberLogin(GoogleLoginRequest request) {

return ResponseEntity.status(HttpStatus.CREATED)
.header("Access-Token", accessToken)
.header("Refresh-Token", refreshToken)
.body("신규 멤버 로그인");
.header("Refresh-Token", refreshToken);
}

}
Expand Down

0 comments on commit a602c76

Please sign in to comment.