Merge pull request #22422 from nextcloud/fix/unified-search-pagination

Add the missing cursor parameter to unified search requests
This commit is contained in:
Joas Schilling 2020-08-26 10:15:12 +02:00 committed by GitHub
commit 2056510214
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 5 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -53,8 +53,15 @@ 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,
// Sending which location we're currently at
from: window.location.pathname.replace('/index.php', '') + window.location.search,
}
})
}

View File

@ -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) {