From 1c3cbac11ba41110e30dcf68a1c686a919256266 Mon Sep 17 00:00:00 2001 From: Jisu Kim Date: Sun, 8 Dec 2024 01:02:34 +0900 Subject: [PATCH] =?UTF-8?q?[WEAV-154]=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20reset=20API=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Features/Home/Sources/Profile/ProfileView.swift | 6 +++++- .../Sources/ProfilePannel/ProfilePanelView.swift | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Projects/Features/Home/Sources/Profile/ProfileView.swift b/Projects/Features/Home/Sources/Profile/ProfileView.swift index b6262a2..42ccd50 100644 --- a/Projects/Features/Home/Sources/Profile/ProfileView.swift +++ b/Projects/Features/Home/Sources/Profile/ProfileView.swift @@ -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) diff --git a/Projects/Features/Home/Sources/ProfilePannel/ProfilePanelView.swift b/Projects/Features/Home/Sources/ProfilePannel/ProfilePanelView.swift index 99c85c6..69301b0 100644 --- a/Projects/Features/Home/Sources/ProfilePannel/ProfilePanelView.swift +++ b/Projects/Features/Home/Sources/ProfilePannel/ProfilePanelView.swift @@ -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 @@ -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) {} }, @@ -112,7 +121,6 @@ struct ProfilePannelView: View { isShowPhotoPreview = false } } catch { - print(error) ToastHelper.showErrorMessage( "프로필 사진 업로드에 실패하였습니다." )