diff --git a/Projects/App/Sources/MainTabSplit/Pokit/PokitSplitFeature.swift b/Projects/App/Sources/MainTabSplit/Pokit/PokitSplitFeature.swift index 68685ed5..4843e2d8 100644 --- a/Projects/App/Sources/MainTabSplit/Pokit/PokitSplitFeature.swift +++ b/Projects/App/Sources/MainTabSplit/Pokit/PokitSplitFeature.swift @@ -292,12 +292,22 @@ private extension PokitSplitFeature { .send(.포킷(.delegate(.미분류_카테고리_컨텐츠_조회))), .send(.카테고리상세(.delegate(.카테고리_내_컨텐츠_목록_조회))) ) + case .링크추가(.delegate(.포킷추가하기)): + state.포킷추가및수정 = .init(type: .추가) + return .none case .링크추가: return .none // - MARK: 포킷추가및수정 - case .포킷추가및수정(.presented(.delegate(.settingSuccess))): - return .send(.포킷(.delegate(.미분류_카테고리_컨텐츠_조회))) + case let .포킷추가및수정(.presented(.delegate(.settingSuccess(category)))): + var mergeEffect: [Effect] = [ + .send(.포킷(.delegate(.미분류_카테고리_컨텐츠_조회))), + .send(.포킷추가및수정(.dismiss)) + ] + if let category { + mergeEffect.append(.send(.inner(.카테고리_상세_활성화(category)))) + } + return .merge(mergeEffect) case .포킷추가및수정: return .none diff --git a/Projects/Feature/FeatureCategorySetting/Sources/PokitCategorySettingFeature.swift b/Projects/Feature/FeatureCategorySetting/Sources/PokitCategorySettingFeature.swift index b6413230..f78f5a68 100644 --- a/Projects/Feature/FeatureCategorySetting/Sources/PokitCategorySettingFeature.swift +++ b/Projects/Feature/FeatureCategorySetting/Sources/PokitCategorySettingFeature.swift @@ -108,7 +108,7 @@ public struct PokitCategorySettingFeature { public enum DelegateAction: Equatable { /// 이전화면으로 돌아가 카테고리 항목을 추가하면됨 - case settingSuccess + case settingSuccess(BaseCategoryItem?) case linkCopyDetected(URL?) } } @@ -182,14 +182,25 @@ private extension PokitCategorySettingFeature { createdAt: "" ) await send(.inner(.카테고리_인메모리_저장(responseToCategoryDomain))) - await send(.delegate(.settingSuccess)) + await send(.delegate(.settingSuccess(responseToCategoryDomain))) case .수정: guard let categoryId = domain.categoryId else { return } guard let image = domain.categoryImage else { return } let request = CategoryEditRequest(categoryName: domain.categoryName, categoryImageId: image.id) - let _ = try await categoryClient.카테고리_수정(categoryId, request) - await send(.delegate(.settingSuccess)) + let response = try await categoryClient.카테고리_수정(categoryId, request) + let category = BaseCategoryItem( + id: response.categoryId, + userId: 0, + categoryName: response.categoryName, + categoryImage: BaseCategoryImage( + imageId: response.categoryImage.imageId, + imageURL: response.categoryImage.imageUrl + ), + contentCount: 0, + createdAt: "" + ) + await send(.delegate(.settingSuccess(category))) case .공유추가: guard let categoryId = domain.categoryId else { return } @@ -201,7 +212,7 @@ private extension PokitCategorySettingFeature { categoryImageId: image.id ) ) - await send(.delegate(.settingSuccess)) + await send(.delegate(.settingSuccess(nil))) } } catch: { error, send in guard let errorResponse = error as? ErrorResponse else { return }