Skip to content

Commit

Permalink
feat: activeInfoId가 유효하지 않으면 새로 발급한다
Browse files Browse the repository at this point in the history
  • Loading branch information
soomanbaek committed Sep 1, 2023
1 parent 140cf6e commit 2d6da7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public ResponseEntity<SuccessResponse<GetMyActiveInfoResponse>> getActiveInfo(
@PathVariable String panelSid,
@CookieValue(value = "active_info_id", required = false) String activeInfoId
){
// ActiveInfoId가 없는 사용자에게 ActiveInfoId를 쿠키로 새로 발급한다.
if(activeInfoId == null){
// ActiveInfoId가 유효하지 않으면, ActiveInfoId를 쿠키로 새로 발급한다.
if(activeInfoId == null || panelService.isNotExistActiveInfo(activeInfoId)){
Cookie activeInfoIdCookie = cookieService.issueActiveInfoIdCookie();
httpResponse.addCookie(activeInfoIdCookie);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,8 @@ private ActiveInfo getActiveInfo(String activeInfoId) {
return activeInfoRepository.findById(activeInfoId)
.orElseThrow(() -> new RestApiException(NOT_EXIST_ACTIVE_INFO));
}

public boolean isNotExistActiveInfo(String activeInfoId){
return !activeInfoRepository.existsById(activeInfoId);
}
}

0 comments on commit 2d6da7c

Please sign in to comment.