From 5b8fdcf32b55bf3faab3527c44e8043162a88f0a Mon Sep 17 00:00:00 2001
From: esikkala <esko.ikkala@aalto.fi>
Date: Thu, 18 Nov 2021 08:48:48 +0200
Subject: [PATCH] Paginated results: fix pagesize datatype

---
 src/client/epics/index.js     | 8 ++++----
 src/client/helpers/helpers.js | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/client/epics/index.js b/src/client/epics/index.js
index d37b12fa..86152176 100644
--- a/src/client/epics/index.js
+++ b/src/client/epics/index.js
@@ -77,10 +77,10 @@ const fetchPaginatedResultsEpic = (action$, state$) => action$.pipe(
     const params = stateToUrl({
       facets: state[`${facetClass}Facets`].facets,
       facetClass: null,
-      page: page,
-      pagesize: pagesize,
-      sortBy: sortBy,
-      sortDirection: sortDirection
+      page,
+      pagesize,
+      sortBy,
+      sortDirection
     })
     const requestUrl = `${apiUrl}/faceted-search/${resultClass}/paginated`
     // https://rxjs-dev.firebaseapp.com/api/ajax/ajax
diff --git a/src/client/helpers/helpers.js b/src/client/helpers/helpers.js
index 0ac74f64..8865d9a4 100644
--- a/src/client/helpers/helpers.js
+++ b/src/client/helpers/helpers.js
@@ -21,7 +21,7 @@ export const stateToUrl = ({
   const params = {}
   if (facetClass !== null) { params.facetClass = facetClass }
   if (page !== null) { params.page = page }
-  if (pagesize !== null) { params.pagesize = pagesize }
+  if (pagesize !== null) { params.pagesize = parseInt(pagesize) }
   if (sortBy !== null) { params.sortBy = sortBy }
   if (sortDirection !== null) { params.sortDirection = sortDirection }
   if (resultFormat !== null) { params.resultFormat = resultFormat }
@@ -123,7 +123,7 @@ export const handleAxiosError = error => {
 
 export const pickSelectedDatasets = datasets => {
   const selected = []
-  Object.keys(datasets).map(key => {
+  Object.keys(datasets).forEach(key => {
     if (datasets[key].selected) {
       selected.push(key)
     }
-- 
GitLab