feat: 상단에 최근 공지사항 표시

This commit is contained in:
Yu Sung
2025-07-28 20:02:54 +09:00
parent b20a6cb0f6
commit 7d22a29517
4 changed files with 62 additions and 13 deletions

View File

@@ -125,4 +125,30 @@ final class MyPageViewModel: ObservableObject {
isShowPopup = true
}
}
func getLatestNotice() {
noticeRepository.getLatestNotice()
.sink { result in
switch result {
case .finished:
DEBUG_LOG("finish")
case .failure(let error):
ERROR_LOG(error.localizedDescription)
}
} receiveValue: {[unowned self] response in
self.isLoading = false
let responseData = response.data
do {
let jsonDecoder = JSONDecoder()
let decoded = try jsonDecoder.decode(ApiResponse<NoticeItem>.self, from: responseData)
if let data = decoded.data, decoded.success {
self.latestNotice = data
}
} catch {
}
}
.store(in: &subscription)
}
}