From d0258ded4337fdedc8deb9feb4d6e14b371194e5 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Tue, 13 Aug 2024 14:17:34 +0000 Subject: [PATCH] Bug 10190: Add a library API client This patch adds a library api client to the vue ecosystem for later use in the Circulation triggers page. Sponsored-by: Glasgow Colleges Library Group --- .../prog/js/vue/fetch/api-client.js | 4 ++++ .../prog/js/vue/fetch/library-api-client.js | 23 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/fetch/library-api-client.js 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 4bfd3c8dd0c..5391881cfd6 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,19 +1,23 @@ import ERMAPIClient from "./erm-api-client"; import PatronAPIClient from "./patron-api-client"; +import LibraryAPIClient from "./library-api-client"; import AcquisitionAPIClient from "./acquisition-api-client"; import AVAPIClient from "./authorised-values-api-client"; import ItemAPIClient from "./item-api-client"; import RecordSourcesAPIClient from "./record-sources-api-client"; import SysprefAPIClient from "./system-preferences-api-client"; import PreservationAPIClient from "./preservation-api-client"; +import CircRuleAPIClient from "./circulation-rules-api-client"; export const APIClient = { erm: new ERMAPIClient(), patron: new PatronAPIClient(), + library: new LibraryAPIClient(), acquisition: new AcquisitionAPIClient(), authorised_values: new AVAPIClient(), item: new ItemAPIClient(), sysprefs: new SysprefAPIClient(), preservation: new PreservationAPIClient(), record_sources: new RecordSourcesAPIClient(), + circRule: new CircRuleAPIClient(), }; diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/library-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/library-api-client.js new file mode 100644 index 00000000000..1111413ada0 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/library-api-client.js @@ -0,0 +1,23 @@ +import HttpClient from "./http-client"; + +export class LibraryAPIClient extends HttpClient { + constructor() { + super({ + baseURL: "/api/v1/", + }); + } + + get libraries() { + return { + getAll: (query, params, headers) => + this.getAll({ + endpoint: "libraries", + query, + params, + headers, + }), + }; + } +} + +export default LibraryAPIClient; -- 2.47.0