Skip to content

Conversation

@dlwogus0128
Copy link
Contributor

🌱 작업한 내용

  • 마이페이지 api 연결

🌱 PR Point

  • 우하핫 첫 api 연결 ㅋ

📸 스크린샷

생략

📮 관련 이슈

서버통신 이후 UI에 받아 온 데이터 값이 반영될 수 있도록 수정
@dlwogus0128 dlwogus0128 self-assigned this Jan 10, 2023
@dlwogus0128 dlwogus0128 added Feat 새로운 기능 구현 재현🐶 labels Jan 10, 2023
Copy link
Collaborator

@lsj8706 lsj8706 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다~~!
리뷰 반영해서 푸시하고 머지해주세요~!!!


import Foundation

// MARK: - MyPageDto
Copy link
Collaborator

Choose a reason for hiding this comment

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

가능하다면 MARK 구문 밑에 한줄은 여백으로 남겨주세요!

let level, levelPercent: Int

enum CodingKeys: String, CodingKey {
case machineID = "machineId"
Copy link
Collaborator

Choose a reason for hiding this comment

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

지금 이 구문이 있는 이유는 machineId라고 서버에서 보내준 것을 struct 프로퍼티에서는 machineID 라고 이름짓기 위해서 들어 있는 거에요! 퀵타입이 Id가 싫어서 ID로 맘대로 바꾼거죠! ㅋㅋㅋㅋ
그래서 뭐 이대로 둬도 상관은 없는데 우리는 그냥 서버에서 주는대로 Id 라고 적고 있어서 이 enum 자체를 없애고 17줄에 machineID를 machineId로 바꿔도 똑같이 동작할 거에요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

헉 ㅋ

setMyRunningLevelLavel(label: myRunningLevelLavel, model: model)
}

private func setMyRunningProgressPercentLabel(label: UILabel, model: MyPageDto) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

함수로 잘 분리해서 만들었네요~~! 👍

extension MyPageVC {
func getMyPageInfo() {
LoadingIndicator.showLoading()
myPageProvider.request(.getMyPageInfo) { [weak self] response in
Copy link
Collaborator

Choose a reason for hiding this comment

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

weak self 를 왜 사용하는지에 대해서도 깊게 공부해보면 좋아요!! Swift의 핵심 특징중 하나인 ARC에 관련된 내용이라 나중에 시간 나면 꼭꼭 공부해보면 좋을 거 같아요~!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵! 그냥 따라했어욥..ㅋ

Comment on lines 342 to 347
if responseDto.status == 200 {
guard let data = responseDto.data else { return }
self.setData(model: data)
} else {
self.showToast(message: responseDto.message)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기서 if responseDto.status == 200 를 제가 다른 코드에서 쓴 이유는 해당 API 에서는 200으로 오는 경우랑 201로 오는 경우를 구분해야 했어서 그런거였어요! 만약 이 API 에서는 200과 다른 200번대 status 의 별다른 차이가 없다면 지금 이 if~else 구문은 없애고 바로

guard let data = ~~ 
self.setData(~~)

이렇게 써도 됩니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dlwogus0128 dlwogus0128 merged commit 76464ea into Runnect:develop Jan 10, 2023
@dlwogus0128 dlwogus0128 deleted the feat/#65-마이페이지-API-연결 branch January 10, 2023 14:13
@dlwogus0128 dlwogus0128 changed the title [Feat] #65 - 마이페이지 api 연결 [Feat] #65 - 마이페이지 API 연결 Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feat 새로운 기능 구현 재현🐶

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Feat] 마이페이지 API 연결

2 participants