Skip to content

Commit

Permalink
[Fix] Runnect#99 - 코스 검색 서버 통신 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
lsj8706 committed Jan 12, 2023
1 parent b96e300 commit 6086d0c
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ final class CourseSearchVC: UIViewController {
private let dividerView = UIView().then {
$0.backgroundColor = .g5
}

private lazy var mapCollectionView: UICollectionView = {
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .vertical
Expand Down Expand Up @@ -103,6 +104,7 @@ extension CourseSearchVC {
}
private func setData(data: [PublicCourse]) {
self.courseList = data
self.emptyDataView.isHidden = !data.isEmpty
mapCollectionView.reloadData()
}
}
Expand Down Expand Up @@ -130,7 +132,9 @@ extension CourseSearchVC {
make.top.equalTo(self.dividerView.snp.bottom)
make.leading.trailing.bottom.equalTo(self.view.safeAreaLayoutGuide)
}

mapCollectionView.addSubview(emptyDataView)

emptyDataView.snp.makeConstraints { make in
make.center.equalToSuperview()
}
Expand Down Expand Up @@ -194,6 +198,7 @@ extension CourseSearchVC: UICollectionViewDelegateFlowLayout {

extension CourseSearchVC: CustomNavigationBarDelegate {
func searchButtonDidTap(text: String) {
guard !text.isEmpty else { return }
searchCourseWithKeyword(keyword: text)
self.keyword = text
}
Expand Down Expand Up @@ -224,6 +229,7 @@ extension CourseSearchVC {
guard let data = responseDto.data else { return }
self.setData(data: data.publicCourses)
} catch {
self.setData(data: [])
print(error.localizedDescription)
}
}
Expand Down

0 comments on commit 6086d0c

Please sign in to comment.