설정 페이지 추가
This commit is contained in:
45
SodaLive/Sources/Settings/Notice/NoticeApi.swift
Normal file
45
SodaLive/Sources/Settings/Notice/NoticeApi.swift
Normal file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// NoticeApi.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/10.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Moya
|
||||
|
||||
enum NoticeApi {
|
||||
case getNotices
|
||||
}
|
||||
|
||||
extension NoticeApi: TargetType {
|
||||
var baseURL: URL {
|
||||
return URL(string: BASE_URL)!
|
||||
}
|
||||
|
||||
var path: String {
|
||||
switch self {
|
||||
case .getNotices:
|
||||
return "/notice"
|
||||
}
|
||||
}
|
||||
|
||||
var method: Moya.Method {
|
||||
return .get
|
||||
}
|
||||
|
||||
var task: Task {
|
||||
switch self {
|
||||
case .getNotices:
|
||||
let parameters = ["timezone": TimeZone.current.identifier] as [String: Any]
|
||||
return .requestParameters(parameters: parameters, encoding: URLEncoding.queryString)
|
||||
}
|
||||
}
|
||||
|
||||
var headers: [String : String]? {
|
||||
switch self {
|
||||
default:
|
||||
return ["Authorization": "Bearer \(UserDefaults.string(forKey: UserDefaultsKey.token))"]
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user