Skip to content

Commit

Permalink
[FEAT] TeamNADA#56 명함 검색 서버통신
Browse files Browse the repository at this point in the history
  • Loading branch information
dlwns33 committed Nov 12, 2021
1 parent 1f62610 commit 1fa120b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ extension GroupService: TargetType {
return .requestJSONEncodable(cardRequest)
case .cardListFetch(let cardListRequest):
return .requestParameters(parameters: ["userId": cardListRequest.userId,
"groupId" : cardListRequest.groupId,
"offset" : cardListRequest.offset], encoding: URLEncoding.queryString)
"groupId": cardListRequest.groupId,
"offset": cardListRequest.offset], encoding: URLEncoding.queryString)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class GroupViewController: UIViewController {
// postCardAddInGroupWithAPI(cardRequest: CardAddInGroupRequest(cardId: "cardA", userId: "nada", groupId: 1))
// 그룹 속 명함 조회 테스트
// getCardListWithAPI(cardListRequest: CardListRequest(userId: "nada2", groupId: 3, offset: 0))
// 명함 검색 테스트
// getCardDetailFetchWithAPI(cardID: "cardA")

}

}
Expand Down Expand Up @@ -150,4 +153,24 @@ extension GroupViewController {
}
}
}

func getCardDetailFetchWithAPI(cardID: String) {
CardAPI.shared.getCardDetailFetch(cardID: cardID) { response in
switch response {
case .success(let data):
if let card = data as? Card {
// print(card)
//통신 성공
}
case .requestErr(let message):
print("getCardDetailFetchWithAPI - requestErr", message)
case .pathErr:
print("getCardDetailFetchWithAPI - pathErr")
case .serverErr:
print("getCardDetailFetchWithAPI - serverErr")
case .networkFail:
print("getCardDetailFetchWithAPI - networkFail")
}
}
}
}

0 comments on commit 1fa120b

Please sign in to comment.