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 <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
00459adfa2
commit
904badad56
|
@ -53,8 +53,13 @@ export async function getTypes() {
|
||||||
*
|
*
|
||||||
* @param {string} type the type to search
|
* @param {string} type the type to search
|
||||||
* @param {string} query the search
|
* @param {string} query the search
|
||||||
|
* @param {int|string|undefined} cursor the offset for paginated searches
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
export function search(type, query) {
|
export function search(type, query, cursor) {
|
||||||
return axios.get(generateUrl(`/search/providers/${type}/search?term=${query}`))
|
return axios.get(generateUrl(`/search/providers/${type}/search?term=${query}`), {
|
||||||
|
params: {
|
||||||
|
cursor,
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,7 +338,7 @@ export default {
|
||||||
this.$set(this.loading, type, true)
|
this.$set(this.loading, type, true)
|
||||||
|
|
||||||
if (this.cursors[type]) {
|
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
|
// Save cursor if any
|
||||||
if (request.data.cursor) {
|
if (request.data.cursor) {
|
||||||
|
|
Loading…
Reference in New Issue