From 1460ff507d0d0c0fc61ded3016e4229cde249441 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 6 Jul 2023 16:13:22 +0200 Subject: [PATCH] Bug 34219: Allow getAll to receive additional URL parameters It's not possible to pass additional URL parameters. We need it at least for bug 32474. --- .../prog/js/vue/fetch/acquisition-api-client.js | 6 ++++-- .../prog/js/vue/fetch/erm-api-client.js | 15 +++++++++------ .../prog/js/vue/fetch/http-client.js | 1 + 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js index 4a4553506ef..d3f4e5ddd21 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js @@ -9,9 +9,11 @@ export class AcquisitionAPIClient extends HttpClient { get vendors() { return { - getAll: query => + getAll: (query, params) => this.get({ - endpoint: "vendors?" + (query || "_per_page=-1"), + endpoint: "vendors", + query, + params, headers: { "x-koha-embed": "aliases", }, diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js index f9be2c5aa07..e298f7f8fbd 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js @@ -17,10 +17,11 @@ export class ERMAPIClient extends HttpClient { "periods,user_roles,user_roles.patron,agreement_licenses,agreement_licenses.license,agreement_relationships,agreement_relationships.related_agreement,documents,agreement_packages,agreement_packages.package,vendor", }, }), - getAll: query => + getAll: (query, params) => this.getAll({ endpoint: "agreements", - query: query, + query, + params, }), delete: id => this.delete({ @@ -59,10 +60,11 @@ export class ERMAPIClient extends HttpClient { "user_roles,user_roles.patron,vendor,documents", }, }), - getAll: query => + getAll: (query, params) => this.getAll({ endpoint: "licenses", - query: query, + query, + params, headers: { "x-koha-embed": "vendor", }, @@ -104,10 +106,11 @@ export class ERMAPIClient extends HttpClient { "package_agreements,package_agreements.agreement,resources+count,vendor", }, }), - getAll: query => + getAll: (query, params) => this.getAll({ endpoint: "eholdings/local/packages", - query: query, + query, + params, headers: { "x-koha-embed": "resources+count,vendor.name", }, diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/http-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/http-client.js index 936231c3f60..8d880d258ef 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/http-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/http-client.js @@ -57,6 +57,7 @@ class HttpClient { "?" + new URLSearchParams({ _per_page: -1, + ...(params.params && params.params), ...(params.query && { q: JSON.stringify(params.query) }), }); return this._fetchJSON(url, params.headers, { -- 2.25.1