Skip to content

Commit

Permalink
🐛 [fix] unlink 시 accessToken 재발급 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
minwoo0419 committed Jul 18, 2024
1 parent 234f8ab commit c117aa9
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public GoogleCalendar register(final String code, final Long userId) {
GoogleCalendar.builder()
.user(user)
.email(data.email())
.serialId(data.sub())
.accessToken(tokens.accessToken())
.refreshToken(tokens.refreshToken())
.build()
Expand All @@ -92,7 +91,12 @@ public GoogleCalendar register(final String code, final Long userId) {
public void unlink(final Long userId, final Long googleCalenderId){
User user = userRetriever.findByUserId(userId);
GoogleCalendar googleCalendar = googleCalendarRetriever.findByIdAndUser(googleCalenderId, user);
googleService.unlink(googleCalendar.getAccessToken());
try {
googleService.unlink(googleCalendar.getAccessToken());
} catch (Exception e) {
reissue(googleCalendar);
googleService.unlink(googleCalendar.getAccessToken());
}
googleCalendarRemover.remove(googleCalendar);
}

Expand All @@ -110,12 +114,12 @@ public List<GoogleSchedulesDto> getGoogleCalendars(
googleCalender -> {
try {
schedules.addAll(getEvents(googleCalender, startDate, range, categoriesDto));
} catch (IOException e) {
} catch (Exception e) {
reissue(googleCalender);
try {
schedules.addAll(getEvents(googleCalender, startDate, range, categoriesDto));
} catch (IOException ioException) {
log.error("Google Calender Error : {}", ioException.getMessage());
} catch (Exception ex) {
log.error("Google Calender Error : {}", ex.getMessage());
}
}
}
Expand All @@ -134,12 +138,12 @@ public GoogleCategoriesDto getCategories(
googleCalender -> {
try {
categories.addAll(getCategories(googleCalender));
} catch (IOException e) {
} catch (Exception e) {
reissue(googleCalender);
try {
categories.addAll(getCategories(googleCalender));
} catch (IOException ioException) {
log.error("Google Calender Error : {}", ioException.getMessage());
} catch (Exception ex) {
log.error("Google Calender Error : {}", ex.getMessage());
}
}
}
Expand Down

0 comments on commit c117aa9

Please sign in to comment.