Skip to content

Commit

Permalink
Merge pull request #1484 from wordpress-mobile/wc/orderlist-search
Browse files Browse the repository at this point in the history
Woo: Only include the `search` query param when fetching orders if it's being used
  • Loading branch information
0nko authored Jan 23, 2020
2 parents f18e8d7 + b62b027 commit 370e6d8
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,14 @@ class OrderRestClient(
val url = WOOCOMMERCE.orders.pathV3
val responseType = object : TypeToken<List<OrderSummaryApiResponse>>() {}.type
val networkPageSize = listDescriptor.config.networkPageSize
val params = mapOf(
val params = mutableMapOf(
"per_page" to networkPageSize.toString(),
"offset" to offset.toString(),
"status" to statusFilter,
"_fields" to "id,date_created_gmt,date_modified_gmt",
"search" to listDescriptor.searchQuery.orEmpty())
"_fields" to "id,date_created_gmt,date_modified_gmt")
listDescriptor.searchQuery.takeUnless { it.isNullOrEmpty() }?.let {
params.put("search", it)
}
val request = JetpackTunnelGsonRequest.buildGetRequest(url, listDescriptor.site.siteId, params, responseType,
{ response: List<OrderSummaryApiResponse>? ->
val orderSummaries = response?.map {
Expand Down

0 comments on commit 370e6d8

Please sign in to comment.