콘텐츠 전체보기
- 카테고리 추가
This commit is contained in:
45
SodaLive/Sources/Content/Category/CategoryApi.swift
Normal file
45
SodaLive/Sources/Content/Category/CategoryApi.swift
Normal file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// CategoryApi.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2/7/24.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Moya
|
||||
|
||||
enum CategoryApi {
|
||||
case getCategoryList(creatorId: Int)
|
||||
}
|
||||
|
||||
extension CategoryApi: TargetType {
|
||||
var baseURL: URL {
|
||||
return URL(string: BASE_URL)!
|
||||
}
|
||||
|
||||
var path: String {
|
||||
switch self {
|
||||
case .getCategoryList:
|
||||
return "/category"
|
||||
}
|
||||
}
|
||||
|
||||
var method: Moya.Method {
|
||||
switch self {
|
||||
case .getCategoryList:
|
||||
return .get
|
||||
}
|
||||
}
|
||||
|
||||
var task: Moya.Task {
|
||||
switch self {
|
||||
case .getCategoryList(let creatorId):
|
||||
let parameters = ["creatorId": creatorId] as [String : Any]
|
||||
return .requestParameters(parameters: parameters, encoding: URLEncoding.queryString)
|
||||
}
|
||||
}
|
||||
|
||||
var headers: [String : String]? {
|
||||
return ["Authorization": "Bearer \(UserDefaults.string(forKey: UserDefaultsKey.token))"]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user