From d057715f85f31dea852420da9cd9537705d99c2d Mon Sep 17 00:00:00 2001 From: JinUng41 Date: Mon, 9 Sep 2024 12:51:31 +0900 Subject: [PATCH] =?UTF-8?q?refactor/#373=20=EB=AA=A8=EC=9E=84=20=EB=82=B4?= =?UTF-8?q?=20=EC=95=BD=EC=86=8D=20=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=20=EB=A9=94=EC=84=9C=EB=93=9C=20RxMoya=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Network/Service/MeetingService.swift | 23 ++++++++++++++----- .../Service/MeetingInfoService.swift | 5 +++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/KkuMulKum/Network/Service/MeetingService.swift b/KkuMulKum/Network/Service/MeetingService.swift index 61000c1e..20ff4804 100644 --- a/KkuMulKum/Network/Service/MeetingService.swift +++ b/KkuMulKum/Network/Service/MeetingService.swift @@ -57,11 +57,22 @@ extension MeetingService: MeetingInfoServiceProtocol { func fetchMeetingPromiseList( with meetingID: Int, isParticipant: Bool? - ) async throws -> ResponseBodyDTO? { - guard let isParticipant else { - return try await request(with: .fetchMeetingPromiseList(meetingID: meetingID)) + ) -> Single> { + if let isParticipant { + return provider.rx.request(.fetchParticipatedPromiseList(meetingID: meetingID, isParticipant: isParticipant)) + .map(ResponseBodyDTO.self) + .catch { error in + print(">>> 에러 발생: \(error.localizedDescription) : \(#function) : \(Self.self)") + return .error(error) + } } - return try await request(with: .fetchParticipatedPromiseList(meetingID: meetingID, isParticipant: isParticipant)) + + return provider.rx.request(.fetchMeetingPromiseList(meetingID: meetingID)) + .map(ResponseBodyDTO.self) + .catch { error in + print(">>> 에러 발생: \(error.localizedDescription) : \(#function) : \(Self.self)") + return .error(error) + } } func exitMeeting(with meetingID: Int) -> Single> { @@ -187,7 +198,7 @@ final class MockMeetingInfoService: MeetingInfoServiceProtocol { func fetchMeetingPromiseList( with meetingID: Int, isParticipant: Bool? - ) async throws -> ResponseBodyDTO? { + ) -> Single> { let mockData = MeetingPromisesModel( promises: [ MeetingPromise(promiseID: 1,name: "꾸물 리프레시 데이",dDay: 0,time: "PM 2:00",placeName: "DMC역"), @@ -208,7 +219,7 @@ final class MockMeetingInfoService: MeetingInfoServiceProtocol { ] ) - return ResponseBodyDTO(success: true, data: mockData, error: nil) + return .just(ResponseBodyDTO(success: true, data: mockData, error: nil)) } func exitMeeting(with meetingID: Int) -> Single> { diff --git a/KkuMulKum/Source/MeetingInfo/Service/MeetingInfoService.swift b/KkuMulKum/Source/MeetingInfo/Service/MeetingInfoService.swift index d3ed092b..2489ea98 100644 --- a/KkuMulKum/Source/MeetingInfo/Service/MeetingInfoService.swift +++ b/KkuMulKum/Source/MeetingInfo/Service/MeetingInfoService.swift @@ -12,6 +12,9 @@ import RxSwift protocol MeetingInfoServiceProtocol { func fetchMeetingInfo(with meetingID: Int) async throws -> ResponseBodyDTO? func fetchMeetingMemberList(with meetingID: Int) async throws -> ResponseBodyDTO? - func fetchMeetingPromiseList(with meetingID: Int, isParticipant: Bool?) async throws -> ResponseBodyDTO? + func fetchMeetingPromiseList( + with meetingID: Int, + isParticipant: Bool? + ) -> Single> func exitMeeting(with meetingID: Int) -> Single> }