@@ -117,10 +117,14 @@ public final class CustomerStore: Store {
117117 let hasNextPage = customers. count == pageSize
118118 if retrieveFullCustomersData {
119119 self . mapSearchResultsToCustomerObjects ( for: siteID,
120- with: keyword,
121- with: customers,
122- hasNextPage: hasNextPage,
123- onCompletion: onCompletion)
120+ with: keyword,
121+ with: customers,
122+ onCompletion: { result in
123+ switch result {
124+ case . success: onCompletion ( . success( hasNextPage) )
125+ case . failure( let error) : onCompletion ( . failure( error) )
126+ }
127+ } )
124128 } else {
125129 self . upsertCustomersAndSave ( siteID: siteID,
126130 readOnlyCustomers: customers,
@@ -262,14 +266,12 @@ public final class CustomerStore: Store {
262266 /// - siteID: The site for which customers should be fetched.
263267 /// - keyword: The keyword used for the Customer search query.
264268 /// - searchResults: A WCAnalyticsCustomer collection that represents the matches we've got from the API based in our keyword search.
265- /// - hasNextPage: Whether there are more pages available.
266269 /// - onCompletion: Invoked when the operation finishes. Will map the result to a `[Customer]` entity.
267270 ///
268271 private func mapSearchResultsToCustomerObjects( for siteID: Int64 ,
269272 with keyword: String ,
270273 with searchResults: [ WCAnalyticsCustomer ] ,
271- hasNextPage: Bool ,
272- onCompletion: @escaping ( Result < Bool , Error > ) -> Void ) {
274+ onCompletion: @escaping ( Result < Void , Error > ) -> Void ) {
273275 var customers = [ Customer] ( )
274276 let group = DispatchGroup ( )
275277 for result in searchResults {
@@ -294,7 +296,7 @@ public final class CustomerStore: Store {
294296 keyword: keyword,
295297 readOnlyCustomers: customers,
296298 onCompletion: {
297- onCompletion ( . success( hasNextPage ) )
299+ onCompletion ( . success( ( ) ) )
298300 }
299301 )
300302 }
0 commit comments