From 164f7fe7e35ca98a7bfa687944001853cad8af52 Mon Sep 17 00:00:00 2001 From: J0onYEong Date: Sat, 9 Nov 2024 16:58:14 +0900 Subject: [PATCH] =?UTF-8?q?[IDLE-000]=20=EC=9A=94=EC=96=91=EB=B3=B4?= =?UTF-8?q?=ED=98=B8=EC=82=AC=20=EC=9B=8C=ED=81=AC=EB=84=B7=20=EA=B3=B5?= =?UTF-8?q?=EA=B3=A0=20=EB=AC=B4=ED=95=9C=20=EC=8A=A4=ED=81=AC=EB=A1=A4=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModel/MainPostBoardViewModel.swift | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/project/Projects/Presentation/Feature/WorkerMainPage/Sources/PostBoard/ViewModel/MainPostBoardViewModel.swift b/project/Projects/Presentation/Feature/WorkerMainPage/Sources/PostBoard/ViewModel/MainPostBoardViewModel.swift index c8bd4917..b127afa9 100644 --- a/project/Projects/Presentation/Feature/WorkerMainPage/Sources/PostBoard/ViewModel/MainPostBoardViewModel.swift +++ b/project/Projects/Presentation/Feature/WorkerMainPage/Sources/PostBoard/ViewModel/MainPostBoardViewModel.swift @@ -211,27 +211,47 @@ class MainPostBoardViewModel: BaseViewModel, WorkerRecruitmentPostBoardVMable { if let prevRequest = self.nextPagingRequest { if let nextPageId = fetchedData.nextPageId { - // 다음값이 있는 경우 + + + // 이전 속성의 다음 페이징 아이디가 있는 경우 + + switch prevRequest { case .initial: + + // 최초요청이후 다음 아이디(네이티브)가 있음 nextRequest = .paging(source: .native, nextPageId: nextPageId) - case .paging(let source, let nextPageId): + + case .paging(let source, _): + + // 이전페이징의 호출속성(native or worknet)을 그대로 따라감, 다만 아이디를 새로운 값으로 업데이트 nextRequest = .paging(source: source, nextPageId: nextPageId) + } } else { - // 다음값이 없는 경우 + + + // 이전 속성의 다음 페이징 아이디가 없는 경우, 즉 해당속성 페이징 종료 + + switch prevRequest { case .initial: - // 써드파티 데이터 호출 + + // 첫번째 호출후 다음 공고가 없음 -> 워크넷 포스트 최초 호출 nextRequest = .paging(source: .thirdParty, nextPageId: nil) + case .paging(let source, _): switch source { case .native: - // 써드파티 데이터 호출 + + // 네이티브 페이징 종료 -> 워크넷 최초호출 nextRequest = .paging(source: .thirdParty, nextPageId: nil) + case .thirdParty: - // 페이징 종료 + + // 워크넷 페이징 종료 nextRequest = nil + } } }