Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network [#82] interceptor 구현 완료 #88

Merged
merged 6 commits into from
Jan 15, 2024
Merged

Conversation

Zoe0929
Copy link
Member

@Zoe0929 Zoe0929 commented Jan 15, 2024

👾 작업 내용

interceptor를 구현했습니다.

  • 서버 통신 중 , 오류가 발생하면 처리하기 위해 구현했습니다.

🚀 PR Point

  • reissue ( 토큰 재발급 통신은 다음과 같이 분기 처리합니다.
  1. 서버 통신 시 statusCode가 401이고, retry 횟수가 2번보다 적을 경우에만 token을 refresh한다.
    1-1. statusCode == 200 일 경우 accessToken이 만료된 상태입니다. refreshToken은 만료되지 않았기 때문에 refreshToken을 이용해서 토큰을 재발급 받고 UserManager에 저장합니다.
    if let data = result.data {
    UserManager.shared.updateToken(data.token.accessToken, data.token.refreshToken)
    }
    print("🪄토큰 재발급에 성공했습니다🪄")
    completion(.retry)

    1-2. statusCode == 401 일 경우 리프레쉬 토큰마저 만료된 경우로 refreshToken, acessToken을 모두 refresh 해야합니다.
    이 경우 다시 로그인해야 하므로 로그인 화면으로 이동합니다. (rootView를 변경해야합니다.)
    } else if statusCode == 401 {
    // 로그아웃 처리 필요
    }

✅ Issue

Resolved #82

@Zoe0929 Zoe0929 linked an issue Jan 15, 2024 that may be closed by this pull request
@Zoe0929 Zoe0929 self-assigned this Jan 15, 2024
@Zoe0929 Zoe0929 added 🐰지희 지희의 issue 📡 network api 작업 labels Jan 15, 2024
@Zoe0929 Zoe0929 added this to the 🚀1차 스프린트🚀 milestone Jan 15, 2024
Copy link
Contributor

@boyeon0119 boyeon0119 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

엘지티앰

Copy link
Member

@kim-seonwoo kim-seonwoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@Zoe0929 Zoe0929 merged commit e0ef07f into develop Jan 15, 2024
@Zoe0929 Zoe0929 deleted the network/#82/Interceptor branch January 15, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐰지희 지희의 issue 📡 network api 작업
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Network] Interceptor 세팅
3 participants