Bugzilla – Attachment 147316 Details for
Bug 32939
Have generic fetch functions in vue modules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32939: Use APIClient to fetch vendors
Bug-32939-Use-APIClient-to-fetch-vendors.patch (text/plain), 3.83 KB, created by
Nick Clemens (kidclamp)
on 2023-02-24 12:22:52 UTC
(
hide
)
Description:
Bug 32939: Use APIClient to fetch vendors
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-02-24 12:22:52 UTC
Size:
3.83 KB
patch
obsolete
>From c13292f85ad42484cb812787173fbf8d9abc8a37 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 21 Feb 2023 10:50:02 +0100 >Subject: [PATCH] Bug 32939: Use APIClient to fetch vendors > >Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../prog/js/vue/components/ERM/Main.vue | 11 ++++++++-- > .../js/vue/fetch/acquisition-api-client.js | 20 +++++++++++++++++++ > .../prog/js/vue/fetch/api-client.js | 2 ++ > .../intranet-tmpl/prog/js/vue/fetch/erm.js | 5 ----- > 4 files changed, 31 insertions(+), 7 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue >index f9f949a635..5eba5d1ee8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue >@@ -122,7 +122,7 @@ > import { inject } from "vue" > import Breadcrumb from "../../components/Breadcrumb.vue" > import Dialog from "../../components/Dialog.vue" >-import { fetchVendors } from "../../fetch/erm.js" >+import { APIClient } from "../../fetch/api-client.js" > import "vue-select/dist/vue-select.css" > > export default { >@@ -154,7 +154,14 @@ export default { > } > }, > beforeCreate() { >- fetchVendors().then(vendors => (this.vendorStore.vendors = vendors)) >+ const client = APIClient.acquisition >+ client.vendors.getAll().then( >+ vendors => { >+ this.vendors = vendors >+ this.initialized = true >+ }, >+ error => {} >+ ) > }, > components: { > Breadcrumb, >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 >new file mode 100644 >index 0000000000..4353ef0ad4 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js >@@ -0,0 +1,20 @@ >+import HttpClient from "./http-client"; >+ >+export class AcquisitionAPIClient extends HttpClient { >+ constructor() { >+ super({ >+ baseURL: "/api/v1/acquisitions/", >+ }); >+ } >+ >+ get vendors() { >+ return { >+ getAll: (query) => >+ this.get({ >+ endpoint: "vendors?" + (query || "_per_page=-1"), >+ }), >+ }; >+ } >+} >+ >+export default AcquisitionAPIClient; >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/api-client.js >index 0b11b7f6d0..20ceaa2e40 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/api-client.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/api-client.js >@@ -1,7 +1,9 @@ > import ERMAPIClient from "./erm-api-client"; > import PatronAPIClient from "./patron-api-client"; >+import AcquisitionAPIClient from "./acquisition-api-client"; > > export const APIClient = { > erm: new ERMAPIClient(), > patron: new PatronAPIClient(), >+ acquisition: new AcquisitionAPIClient(), > }; >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm.js >index 9d8a245933..b76ce379d9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm.js >@@ -2,11 +2,6 @@ import { setError } from "../messages"; > > //TODO: all of these functions should be deleted and reimplemented in the components using ERMAPIClient > >-export const fetchVendors = function () { >- const apiUrl = "/api/v1/acquisitions/vendors?_per_page=-1"; >- return myFetch(apiUrl); >-}; >- > const _createEditPackage = function (method, erm_package) { > let apiUrl = "/api/v1/erm/eholdings/local/packages"; > >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32939
:
146470
|
146509
|
146642
|
146644
|
146645
|
146668
|
146669
|
146670
|
146671
|
146672
|
146674
|
146675
|
146676
|
146677
|
146678
|
146679
|
146680
|
146681
|
146682
|
147029
|
147030
|
147031
|
147032
|
147033
|
147034
|
147035
|
147036
|
147037
|
147038
|
147039
|
147040
|
147041
|
147042
|
147043
|
147044
|
147056
|
147057
|
147059
|
147060
|
147061
|
147062
|
147063
|
147064
|
147065
|
147066
|
147067
|
147068
|
147069
|
147070
|
147071
|
147072
|
147073
|
147306
|
147307
|
147308
|
147309
|
147310
|
147311
|
147312
|
147313
|
147314
|
147315
| 147316 |
147317
|
147318
|
147319
|
147320
|
147321
|
147322
|
147332
|
149441