Bug 32474: Properly call getAll

To encode q parameter correctly, based on bug 33623

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2023-04-27 08:56:39 +02:00 committed by Katrin Fischer
parent 5b6761efdf
commit 409efe6cdd
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -90,7 +90,14 @@ export default {
async fetchInitialData(dataType) { async fetchInitialData(dataType) {
const client = APIClient.erm const client = APIClient.erm
await client[dataType] await client[dataType]
.getAll("_page=1&_per_page=20&_match=contains") .getAll(
{},
{
_page: 1,
_per_page: 20,
_match: "contains",
}
)
.then( .then(
items => { items => {
this.data = items this.data = items
@ -107,10 +114,13 @@ export default {
this.data = [] this.data = []
this.search = e this.search = e
const client = APIClient.erm const client = APIClient.erm
const attribute = "me." + this.queryProperty
const q = {}
q[attribute] = { like: `%${e}%` }
await client[this.dataType] await client[this.dataType]
.getAll( .getAll(q, {
`q={"me.${this.queryProperty}":{"like":"%${e}%"}}&_per_page=-1` _per_page: -1,
) })
.then( .then(
items => { items => {
this.data = items this.data = items
@ -143,7 +153,12 @@ export default {
const client = APIClient.erm const client = APIClient.erm
await client[this.dataType] await client[this.dataType]
.getAll( .getAll(
`_page=${this.scrollPage}&_per_page=20&_match=contains` {},
{
_page: this.scrollPage,
_per_page: 20,
_match: "contains",
}
) )
.then( .then(
items => { items => {