-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
262316a
commit fa80b46
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// GoalClient.swift | ||
// dnd-12th-2-iOS | ||
// | ||
// Created by 권석기 on 3/3/25. | ||
// | ||
|
||
import Foundation | ||
import ComposableArchitecture | ||
import Moya | ||
|
||
struct GoalClient { | ||
static let provider = MoyaProvider<GoalAPI>(session: Session(interceptor: AuthIntercepter.shared), plugins: [MoyaLoggingPlugin()]) | ||
} | ||
|
||
extension GoalClient: DependencyKey { | ||
static let liveValue = Self ( | ||
|
||
) | ||
} | ||
|
||
extension DependencyValues { | ||
var goalClient: GoalClient { | ||
get { self[GoalClient.self] } | ||
set { self[GoalClient.self] = newValue } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// | ||
// GuideClient.swift | ||
// dnd-12th-2-iOS | ||
// | ||
// Created by 권석기 on 3/3/25. | ||
// | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// GoalAPI.swift | ||
// dnd-12th-2-iOS | ||
// | ||
// Created by 권석기 on 3/3/25. | ||
// | ||
|
||
import Foundation | ||
import Moya | ||
|
||
enum GoalAPI { | ||
case makeIn | ||
} | ||
|
||
extension GoalAPI: TargetType { | ||
var baseURL: URL { | ||
return URL(string: "\(SecretKey.baseUrl)/api/goals")! | ||
} | ||
|
||
var path: String { | ||
switch self { | ||
default: | ||
return "" | ||
} | ||
} | ||
|
||
var method: Moya.Method { | ||
switch self { | ||
default: | ||
return .get | ||
} | ||
} | ||
|
||
var task: Moya.Task { | ||
switch self { | ||
default: | ||
return .requestPlain | ||
} | ||
} | ||
|
||
var headers: [String : String]? { | ||
switch self { | ||
default: | ||
return ["Content-type": "application/json"] | ||
} | ||
} | ||
} |