From 1718775c2fc55373ab8bdd33ade65483e358ed1d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 21 Feb 2023 13:09:23 +0100 Subject: [PATCH] Bug 32939: Use APIClient to replace PATCH requests Signed-off-by: Matt Blenkinsop --- .../ERM/EHoldingsEBSCOPackagesShow.vue | 26 ++++-------- .../ERM/EHoldingsEBSCOResourcesShow.vue | 27 ++++-------- .../ERM/EHoldingsLocalTitlesFormImport.vue | 16 ++----- .../prog/js/vue/fetch/erm-api-client.js | 16 ++++++- .../prog/js/vue/fetch/http-client.js | 42 +++++++++++++++---- 5 files changed, 70 insertions(+), 57 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOPackagesShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOPackagesShow.vue index abb80afccc3..a90b0d1523f 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOPackagesShow.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOPackagesShow.vue @@ -170,26 +170,16 @@ export default { }, edit_selected(is_selected) { this.updating_is_selected = true - fetch( - "/api/v1/erm/eholdings/ebsco/packages/" + - this.erm_package.package_id, - { - method: "PATCH", - body: JSON.stringify({ is_selected }), - headers: { - Accept: "application/json", - "Content-Type": "application/json", - }, - } - ) - .then(checkError) - .then(result => { + const client = APIClient.erm + client.EBSCOPackages.patch(this.erm_package.package_id, { + is_selected, + }).then( + result => { // Refresh the page. We should not need that actually. this.getPackage(this.erm_package.package_id) - }) - .catch(error => { - setError(error) - }) + }, + error => {} + ) }, add_to_holdings() { this.edit_selected(true) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOResourcesShow.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOResourcesShow.vue index e764194e937..68d5e23e310 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOResourcesShow.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOResourcesShow.vue @@ -116,7 +116,6 @@