feat(home): 팔로잉 탭 API 상태를 추가한다

This commit is contained in:
Yu Sung
2026-06-30 22:04:40 +09:00
parent e2d46614bd
commit ae09776c9b
9 changed files with 423 additions and 10 deletions

View File

@@ -0,0 +1,38 @@
import Foundation
import Moya
enum MainHomeFollowingApi {
case getFollowing
}
extension MainHomeFollowingApi: TargetType {
var baseURL: URL {
return URL(string: BASE_URL)!
}
var path: String {
switch self {
case .getFollowing:
return "/api/v2/home/following"
}
}
var method: Moya.Method {
switch self {
case .getFollowing:
return .get
}
}
var task: Moya.Task {
switch self {
case .getFollowing:
return .requestPlain
}
}
var headers: [String: String]? {
return ["Authorization": "Bearer \(UserDefaults.string(forKey: UserDefaultsKey.token))"]
}
}

View File

@@ -0,0 +1,12 @@
import Foundation
import CombineMoya
import Combine
import Moya
final class MainHomeFollowingRepository {
private let api = MoyaProvider<MainHomeFollowingApi>()
func getFollowing() -> AnyPublisher<Response, MoyaError> {
return api.requestPublisher(.getFollowing)
}
}