From 904badad56801f069c549f5e4507954b5978476d Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Tue, 25 Aug 2020 17:01:10 +0200 Subject: [PATCH] Add the missing cursor parameter to unified search requests Otherwise paginated search does not work. Basically you always requested the first x items and then showed them again and again. The second or any other subsequent page was never requested. On a side note this also caused lots of Vue warning due to duplicate keys. Signed-off-by: Christoph Wurst --- core/src/services/UnifiedSearchService.js | 9 +++++++-- core/src/views/UnifiedSearch.vue | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/src/services/UnifiedSearchService.js b/core/src/services/UnifiedSearchService.js index 8e4c4a2a073..937fec66723 100644 --- a/core/src/services/UnifiedSearchService.js +++ b/core/src/services/UnifiedSearchService.js @@ -53,8 +53,13 @@ export async function getTypes() { * * @param {string} type the type to search * @param {string} query the search + * @param {int|string|undefined} cursor the offset for paginated searches * @returns {Promise} */ -export function search(type, query) { - return axios.get(generateUrl(`/search/providers/${type}/search?term=${query}`)) +export function search(type, query, cursor) { + return axios.get(generateUrl(`/search/providers/${type}/search?term=${query}`), { + params: { + cursor, + } + }) } diff --git a/core/src/views/UnifiedSearch.vue b/core/src/views/UnifiedSearch.vue index 4f316866862..56cb12d3dc7 100644 --- a/core/src/views/UnifiedSearch.vue +++ b/core/src/views/UnifiedSearch.vue @@ -338,7 +338,7 @@ export default { this.$set(this.loading, type, true) if (this.cursors[type]) { - const request = await search(type, this.query) + const request = await search(type, this.query, this.cursors[type]) // Save cursor if any if (request.data.cursor) { -- 2.39.5