-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Feat] #193 - 액세스 토큰 만료 로직 구현 #207
Changes from 1 commit
945ba60
c0bba45
8ec4d46
07654d7
3c28afd
db4086c
58a6ffc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
// Created by 김민서 on 2023/02/23. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
import Moya | ||
|
||
|
@@ -56,6 +56,15 @@ final class MoyaLoggingPlugin: PluginType { | |
} | ||
log.append("------------------- END HTTP (\(response.data.count)-byte body) -------------------") | ||
print(log) | ||
|
||
switch statusCode { | ||
case 200..<300: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아 글구 케이스를 이렇게 나누면 400에러나 500에러가 뜰때도 보내버려서 분기처리 조건을 수정해야 할듯 합니다~! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아아!! 401만 분기처리해서 올릴게요:) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
return | ||
default: | ||
|
||
let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as! SceneDelegate | ||
sceneDelegate.window?.rootViewController = UINavigationController(rootViewController: AuthViewController()) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 요렇게 해줘도 동작은 하지만 사실 요 플러그인의 기능은 로깅이니까 저희 플젝에서는 Moya를 쓰니까 Moya를 기준으로 알아보면 좋을거를 좀 소개를 해보자면 요걸쓰면 이거를 Moya에서도 provider를 생성할때 LogginPlugin을 넣어준것 처럼 provider = MoyaProvider<~~Router>(
session: Session(interceptor: 만들어준인터셉터()),
plugins: [MoyaLoggingPlugin()]
) 이렇게 만들어주면 해당 provider를 사용하는 곳에선 모두 저 인터셉트를 거치게 됩미다~ https://ios-development.tistory.com/730 요 블로그 보면 좋을 것같아요! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 넹 ! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
func onFail(_ error: MoyaError, target: TargetType) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UIKit도 이제 없어두 될거 같아여!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넹!
db4086c