Skip to content

Commit 7d75bb7

Browse files
authored
Fix/set category(Hometopic) List fixed (#91)
1 parent 784dd84 commit 7d75bb7

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

Wastory/Wastory/View/HomeView/HomeView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ struct HomeView: View {
9494
// MARK: Network
9595
.onAppear {
9696
Task {
97-
await viewModel.getHomeTopicList()
9897
await viewModel.getCategoryPopularPostItems()
9998
}
10099
Task {

Wastory/Wastory/ViewModel/HomeViewModel/HomeViewModel.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,21 @@ import Observation
9494
var todaysWastoryListItems: [Post] = []
9595

9696
//Category Popular Post List
97-
var categoryList: [HomeTopic] = []
97+
var categoryList: [HomeTopic] = [
98+
HomeTopic(id: 2, name: "여행·맛집", highCategory: 0),
99+
HomeTopic(id: 3, name: "리빙·스타일", highCategory: 0),
100+
HomeTopic(id: 4, name: "가족·연애", highCategory: 0),
101+
HomeTopic(id: 5, name: "직장·자기계발", highCategory: 0),
102+
HomeTopic(id: 6, name: "시사·지식", highCategory: 0),
103+
HomeTopic(id: 7, name: "도서·창작", highCategory: 0),
104+
HomeTopic(id: 8, name: "엔터테인먼트", highCategory: 0),
105+
HomeTopic(id: 9, name: "취미·건강", highCategory: 0)
106+
]
98107

99108
let categoryIcons : [Int: String] =
100109
[2: "airplane.departure", 3: "sofa", 4: "person.2", 5: "cpu", 6: "chart.bar.xaxis", 7: "book", 8: "tv", 9: "figure.indoor.soccer"]
101110

102-
var selectedCategory: HomeTopic = HomeTopic.defaultHomeTopic
111+
var selectedCategory: HomeTopic = HomeTopic(id: 2, name: "여행·맛집", highCategory: 0)
103112

104113
var categoryPopularPostItems: [Post] = []
105114

@@ -126,15 +135,6 @@ import Observation
126135
}
127136
}
128137

129-
func getHomeTopicList() async {
130-
do {
131-
categoryList = Array(try await NetworkRepository.shared.getHomeTopicList()[1...8])
132-
selectedCategory = categoryList.first!
133-
} catch {
134-
print("Error: \(error.localizedDescription)")
135-
}
136-
}
137-
138138
func getCategoryPopularPostItems() async {
139139
do {
140140
categoryPopularPostItems = try await NetworkRepository.shared.getArticlesHomeTopic(highHomeTopicID: selectedCategory.id)

0 commit comments

Comments
 (0)