Skip to content

Commit

Permalink
✨ :: [#30] MyPage Info 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Xixn2 committed Dec 27, 2024
1 parent 76c7805 commit 91b1865
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Projects/App/Sources/Application/GPleApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import SwiftUI
struct GPleApp: App {
var body: some Scene {
WindowGroup {
RankView(postViewModel: PostViewModel())
//MyPageView(viewModel: MyPageViewModel(),postViewModel: PostViewModel())
//RankView(postViewModel: PostViewModel())
MyPageView(viewModel: MyPageViewModel(),postViewModel: PostViewModel())
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct MyPageView: View {

HStack(spacing: 0) {
VStack(alignment: .leading, spacing: 4) {
Text("\(viewModel.name)님,")
Text("\(postViewModel.myInfo?.name ?? "")님,")
.foregroundStyle(.white)
.font(GPleFontFamily.Pretendard.regular.swiftUIFont(size: 20))

Expand Down Expand Up @@ -242,6 +242,14 @@ struct MyPageView: View {
print("반응 게시물 최신화 실패")
}
}

postViewModel.myInfo { success in
if success {
print("내 정보 불러오기 성공")
} else {
print("내 정보 불러오기 실패")
}
}
}
.navigationBarBackButtonHidden(true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public final class PostViewModel: ObservableObject {
switch result {
case let .success(response):
do {
print("성공: 유저 리스트 불러오기")
print("성공: 내 정보 불러오기")

self.myInfo = try JSONDecoder().decode(MyInfoResponse.self, from: response.data)

Expand Down
2 changes: 1 addition & 1 deletion Projects/Domain/Sources/API/User/UserAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extension UserAPI: TargetType {
public var path: String {
switch self {
case .userInfoInput:
return "/User/profile"
return "/user/profile"
}
}

Expand Down
2 changes: 1 addition & 1 deletion Projects/Domain/Sources/Response/Post/MyInfoResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation

public struct MyInfoResponse: Identifiable, Codable {
public let id: Int
public let name: String
public let grade: Int
public let name: String
public let profileImage: String
}

0 comments on commit 91b1865

Please sign in to comment.