SodaLive
Preview Content
Resources
Sources
Agora
App
Common
Content
Debug
Dialog
Explorer
Extensions
Follow
Font
IAP
ImagePicker
Keyboard
Live
Main
Message
MyPage
Auth
Can
OrderList
Profile
ReservationStatus
ServiceCenter
Faq.swift
FaqApi.swift
FaqRepository.swift
FaqView.swift
ServiceCenterButtonView.swift
ServiceCenterCategoryItemView.swift
ServiceCenterCategoryView.swift
ServiceCenterView.swift
ServiceCenterViewModel.swift
CanCardView.swift
MyInfoCardView.swift
MyPageResponse.swift
MyPageView.swift
MyPageViewModel.swift
ReservationStatusView.swift
NavigationBar
Onboarding
Report
Settings
Shape
Splash
User
Utils
ContentView.swift
SodaLive.entitlements
SodaLive.xcworkspace
generated
.gitignore
Podfile
Podfile.lock
SodaLive-dev.entitlements
model-SodaLive-dev.json
model-SodaLive.json
49 lines
976 B
Swift
49 lines
976 B
Swift
//
|
|
// FaqApi.swift
|
|
// SodaLive
|
|
//
|
|
// Created by klaus on 2023/08/11.
|
|
//
|
|
|
|
import Foundation
|
|
import Moya
|
|
|
|
enum FaqApi {
|
|
case faqs(category: String)
|
|
case faqCategories
|
|
}
|
|
|
|
extension FaqApi: TargetType {
|
|
var baseURL: URL {
|
|
return URL(string: BASE_URL)!
|
|
}
|
|
|
|
var path: String {
|
|
switch self {
|
|
case .faqs:
|
|
return "/faq"
|
|
|
|
case .faqCategories:
|
|
return "/faq/category"
|
|
}
|
|
}
|
|
|
|
var method: Moya.Method {
|
|
return .get
|
|
}
|
|
|
|
var task: Task {
|
|
switch self {
|
|
case .faqCategories:
|
|
return .requestPlain
|
|
|
|
case .faqs(let category):
|
|
return .requestParameters(parameters: ["category" : category] as [String : Any], encoding: URLEncoding.queryString)
|
|
}
|
|
}
|
|
|
|
var headers: [String : String]? {
|
|
return ["Authorization": "Bearer \(UserDefaults.string(forKey: UserDefaultsKey.token))"]
|
|
}
|
|
}
|