Skip to content

Commit

Permalink
[WEAV-154] 프로필 이미지 reset API 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
jisu15-kim committed Dec 7, 2024
1 parent 7275f51 commit 1c3cbac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Projects/Features/Home/Sources/Profile/ProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ public struct ProfileView: View {
ProfilePannelView(
name: userInfo.name,
profile: userInfo.profile
)
) {
Task {
await intent.refreshUserInfo()
}
}

LeftAlignText("Introductions")
.typography(.en_medium_16)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct ProfilePannelView: View {

let name: String
let profile: UserInfoProfile
var refreshHandler: () -> Void

@State var isShowPhotoSheet: Bool = false
@State var isShowPhotoPicker: Bool = false
Expand Down Expand Up @@ -79,7 +80,15 @@ struct ProfilePannelView: View {
isShowPhotoPicker = true
}
Button("기본 이미지 적용") {
// default image
Task {
if let profileImageId = profile.profileImageId {
try await ProfileService.shared.requestResetProfileImage(
imageId: profileImageId
)
_ = try await AppCoordinator.shared.refreshMyUserInfo()
refreshHandler()
}
}
}
Button("취소", role: .cancel) {}
},
Expand Down Expand Up @@ -112,7 +121,6 @@ struct ProfilePannelView: View {
isShowPhotoPreview = false
}
} catch {
print(error)
ToastHelper.showErrorMessage(
"프로필 사진 업로드에 실패하였습니다."
)
Expand Down

0 comments on commit 1c3cbac

Please sign in to comment.