generated from Xixn2/Tuist_Modular_Template
-
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.
Merge pull request #31 from GPle-Team/30-MyPage-MyInfo-Fetch
🔀 :: [#30] 마이페이지 정보 불러오기 구현
- Loading branch information
Showing
5 changed files
with
86 additions
and
61 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
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
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
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 |
---|---|---|
@@ -1,58 +1,44 @@ | ||
//import Foundation | ||
//import Moya | ||
// | ||
//public enum UserAPI { | ||
// case userInfoInput(authorization: String, name: String, number: String, file: Data) | ||
//} | ||
// | ||
//extension UserAPI: TargetType { | ||
// public var baseURL: URL { | ||
// return URL(string: "https://port-0-gple-backend-eg4e2alkoplc4q.sel4.cloudtype.app")! | ||
// } | ||
// | ||
// public var path: String { | ||
// switch self { | ||
// case .userInfoInput: | ||
// return "/profile" | ||
// } | ||
// } | ||
// | ||
// public var method: Moya.Method { | ||
// switch self { | ||
// case .userInfoInput: | ||
// return .post | ||
// } | ||
// } | ||
// | ||
// public var sampleData: Data { | ||
// return "{}".data(using: .utf8)! | ||
// } | ||
// | ||
// public var task: Task { | ||
// switch self { | ||
// case .userInfoInput(let authorization, let name, let number, let file): | ||
// // Form data (name, number) and file upload using multipart | ||
// return .requestCompositeParameters( | ||
// bodyParameters: [ | ||
// "name": name, | ||
// "number": number | ||
// ], | ||
// bodyEncoding: JSONEncoding.default, // Form data with JSON encoding | ||
// urlParameters: [:], // No URL parameters | ||
// multipartBody: [ | ||
// MultipartFormData(provider: .data(file), name: "file", fileName: "profile_image.jpg", mimeType: "image/jpeg") | ||
// ] | ||
// ) | ||
// } | ||
// } | ||
// | ||
// public var headers: [String : String]? { | ||
// switch self { | ||
// case .userInfoInput(let authorization, _, _, _): | ||
// return [ | ||
// "Authorization": "Bearer \(authorization)", // Authorization token | ||
// "Content-Type": "multipart/form-data" // Set content type for multipart requests | ||
// ] | ||
// } | ||
// } | ||
//} | ||
import Foundation | ||
import Moya | ||
|
||
public enum UserAPI { | ||
case userInfoInput(authorization: String) | ||
} | ||
|
||
extension UserAPI: TargetType { | ||
public var baseURL: URL { | ||
return URL(string: "https://port-0-gple-backend-eg4e2alkoplc4q.sel4.cloudtype.app")! | ||
} | ||
|
||
public var path: String { | ||
switch self { | ||
case .userInfoInput: | ||
return "/user/profile" | ||
} | ||
} | ||
|
||
public var method: Moya.Method { | ||
switch self { | ||
case .userInfoInput: | ||
return .get | ||
} | ||
} | ||
|
||
public var sampleData: Data { | ||
return "{}".data(using: .utf8)! | ||
} | ||
|
||
public var task: Task { | ||
switch self { | ||
case .userInfoInput: | ||
return .requestPlain | ||
} | ||
} | ||
|
||
public var headers: [String : String]? { | ||
switch self { | ||
case .userInfoInput(let authorization): | ||
return ["Authorization": authorization] | ||
} | ||
} | ||
} |
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,8 @@ | ||
import Foundation | ||
|
||
public struct MyInfoResponse: Identifiable, Codable { | ||
public let id: Int | ||
public let grade: Int | ||
public let name: String | ||
public let profileImage: String | ||
} |