Skip to content

Commit

Permalink
Merge pull request #313 from boostcampwm2023/iOS/bug#312
Browse files Browse the repository at this point in the history
bug: memberID 요청 전, 토큰을 저장하지 않았던 버그 수정
  • Loading branch information
loinsir authored Dec 12, 2023
2 parents b07571e + 5477193 commit 35779bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions iOS/Layover/Layover/Network/AuthManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ protocol AuthManagerProtocol: AnyObject {
var loginType: LoginType? { get set }
var memberID: Int? { get set }

func login(accessToken: String?, refreshToken: String?, memberID: Int?, loginType: LoginType?)
func login(accessToken: String?, refreshToken: String?, loginType: LoginType?)
func logout()
}

Expand All @@ -23,10 +23,9 @@ enum LoginType: String, Codable {
}

extension AuthManagerProtocol {
func login(accessToken: String?, refreshToken: String?, memberID: Int?, loginType: LoginType?) {
func login(accessToken: String?, refreshToken: String?, loginType: LoginType?) {
self.accessToken = accessToken
self.refreshToken = refreshToken
self.memberID = memberID
self.loginType = loginType
isLoggedIn = true
}
Expand Down
6 changes: 3 additions & 3 deletions iOS/Layover/Layover/Scenes/Login/LoginWorker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ extension LoginWorker: LoginWorkerProtocol {

authManager.login(accessToken: result.data?.accessToken,
refreshToken: result.data?.refreshToken,
memberID: await fetchMemberId(),
loginType: .kakao)
authManager.memberID = await fetchMemberID()
return true
} catch {
os_log(.error, log: .data, "%@", error.localizedDescription)
Expand Down Expand Up @@ -119,16 +119,16 @@ extension LoginWorker: LoginWorkerProtocol {

authManager.login(accessToken: result.data?.accessToken,
refreshToken: result.data?.refreshToken,
memberID: await fetchMemberId(),
loginType: .apple)
authManager.memberID = await fetchMemberID()
return true
} catch {
os_log(.error, log: .data, "%@", error.localizedDescription)
return false
}
}

private func fetchMemberId() async -> Int? {
private func fetchMemberID() async -> Int? {
let endPoint = userEndPointFactory.makeUserInformationEndPoint(with: nil)
do {
let responseData = try await provider.request(with: endPoint)
Expand Down
6 changes: 3 additions & 3 deletions iOS/Layover/Layover/Scenes/SignUpScene/SignUpWorker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ extension SignUpWorker: SignUpWorkerProtocol {

authManager.login(accessToken: data.accessToken,
refreshToken: data.refreshToken,
memberID: await fetchMemberId(),
loginType: .kakao)
authManager.memberID = await fetchMemberID()
return true
} catch {
os_log(.error, log: .data, "Failed to sign up with error: %@", error.localizedDescription)
Expand All @@ -72,16 +72,16 @@ extension SignUpWorker: SignUpWorkerProtocol {
}
authManager.login(accessToken: data.accessToken,
refreshToken: data.refreshToken,
memberID: await fetchMemberId(),
loginType: .apple)
authManager.memberID = await fetchMemberID()
return true
} catch {
os_log(.error, log: .data, "Failed to sign up with error: %@", error.localizedDescription)
return false
}
}

private func fetchMemberId() async -> Int? {
private func fetchMemberID() async -> Int? {
let endPoint = userEndPointFactory.makeUserInformationEndPoint(with: nil)
do {
let responseData = try await provider.request(with: endPoint)
Expand Down

0 comments on commit 35779bd

Please sign in to comment.