Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network [#67] 마이페이지 UserAPI 연결 #76

Merged
merged 7 commits into from
Jan 14, 2024

Conversation

boyeon0119
Copy link
Contributor

👾 작업 내용

  • 마이페이지 유저 이름과 포인트 서버 통신을 했습니다.

서버 통신

  • GetUserDataResponseDTO와 MyPageRouter를 구축해 서버 통신이 필요한 userLabelpointLabel이 있는 **UserPointHeaderView**에서 서버 통신을 해줬습니다.
func getUserDataAPI() {
        provider.request(target: .getUserData, instance: BaseResponse<GetUserDataResponseDTO>.self, viewController: MyPageViewController() ) { data in
            guard let data = data.data else { return }
            self.userLabel.text = data.name
            self.countPointLabel.text = "\(data.point)"
        }
    }

🚀 PR Point

Base Provider 수정

  • BaseResponse를 이용해야 해서 코드를 조금 수정했습니다 (Feat.Zoe)
func request<Model : Codable>(target : Provider, instance : **BaseResponse<Model>**.Type , viewController: UIViewController, completion : @escaping(**BaseResponse<Model>**) -> ()){
        self.request(target) { result in

📸 스크린샷

구현 내용 스크린샷
UserAPI 서버통신 성공

✅ Issue

Resolved #67

@boyeon0119 boyeon0119 added 🙊보연 보연의 issue 📡 network api 작업 labels Jan 13, 2024
@boyeon0119 boyeon0119 added this to the 🚀1차 스프린트🚀 milestone Jan 13, 2024
@boyeon0119 boyeon0119 self-assigned this Jan 13, 2024
Copy link
Member

@Zoe0929 Zoe0929 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[경] ✨ 첫 API 연결 성공 축하드립니다.✨ [축]

self.userLabel.text = model.userName
self.countPointLabel.text = "\(userPoint)"
func getUserDataAPI() {
provider.request(target: .getUserData, instance: BaseResponse<GetUserDataResponseDTO>.self, viewController: MyPageViewController() ) { data in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P4. 요기 줄 바꿈 하는 건 어떠신지! 파라미터 간격으로 하면 더 깔끔할 것 같네용 ㅎㅎ

Copy link
Member

@kim-seonwoo kim-seonwoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다~👍

@@ -8,7 +8,7 @@ import Moya
import UIKit

class NetworkProvider<Provider : TargetType> : MoyaProvider<Provider> {
func request<Model : Codable>(target : Provider, instance : Model.Type , viewController: UIViewController, completion : @escaping(Model) -> ()){
func request<Model : Codable>(target : Provider, instance : BaseResponse<Model>.Type , viewController: UIViewController, completion : @escaping(BaseResponse<Model>) -> ()){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p5. 오 이런 식으로 변경하셨군요!

@boyeon0119 boyeon0119 merged commit 3ac784b into develop Jan 14, 2024
@Zoe0929 Zoe0929 deleted the network/#67-UserApi branch January 19, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📡 network api 작업 🙊보연 보연의 issue
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Network] 마이페이지 유저 정보 서버 통신
3 participants