Skip to content

Commit

Permalink
#7 judgiLoginStauts : 응답실패 분기처리 함수
Browse files Browse the repository at this point in the history
  • Loading branch information
seondal committed Dec 24, 2021
1 parent d92520e commit e7f2489
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Binary file not shown.
15 changes: 13 additions & 2 deletions DalTube/DalTube/Login/UserSignService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,24 @@ struct UserSignService {
case .success :
guard let statusCode = dataResponse.response?.statusCode else {return}
guard let value = dataResponse.value else {return}
let networkResult = self.judgeLgoinStatus(by: stautsCode, value)
let networkResult = self.judgeLoginStatus(by: statusCode, value)
completion(networkResult)

case .failure(let err) :
print(err)
completion(.networkFail)
}
}
}
}

private func judgeLoginStatus(by statusCode: Int, _ data: Data) -> NetworkResult<Any> {
switch statusCode {
case 200: return isValidLoginData(data: data)
case 400: return .pathErr
case 500: return .serverErr
default : return .networkFail
}
}


}

0 comments on commit e7f2489

Please sign in to comment.