Bugzilla – Attachment 147319 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: Remove fetch/erm.js
Bug-32939-Remove-fetchermjs.patch (text/plain), 3.91 KB, created by
Nick Clemens (kidclamp)
on 2023-02-24 12:23:00 UTC
(
hide
)
Description:
Bug 32939: Remove fetch/erm.js
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-02-24 12:23:00 UTC
Size:
3.91 KB
patch
obsolete
>From 18ef7c49ed1d734e12aff663003a590780198328 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 21 Feb 2023 12:42:29 +0100 >Subject: [PATCH] Bug 32939: Remove fetch/erm.js > >Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../intranet-tmpl/prog/js/vue/fetch/erm.js | 106 ------------------ > 1 file changed, 106 deletions(-) > delete mode 100644 koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm.js > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm.js >deleted file mode 100644 >index 851a99a034..0000000000 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm.js >+++ /dev/null >@@ -1,106 +0,0 @@ >-import { setError } from "../messages"; >- >-//TODO: all of these functions should be deleted and reimplemented in the components using ERMAPIClient >- >-const _fetchPackage = function (apiUrl, package_id) { >- if (!package_id) return; >- return myFetch(apiUrl, { >- headers: { >- "x-koha-embed": >- "package_agreements,package_agreements.agreement,resources+count,vendor", >- }, >- }); >-}; >-export const fetchEBSCOPackage = function (package_id) { >- const apiUrl = "/api/v1/erm/eholdings/ebsco/packages/" + package_id; >- return _fetchPackage(apiUrl, package_id); >-}; >- >-export const _fetchPackages = function (apiUrl) { >- return myFetch(apiUrl, { >- headers: { >- "x-koha-embed": "resources+count,vendor.name", >- }, >- }); >-}; >-export const fetchEBSCOPackages = function () { >- const apiUrl = "/api/v1/erm/eholdings/ebsco/packages"; >- return _fetchPackages(apiUrl); >-}; >- >-export const _fetchTitle = function (apiUrl, title_id) { >- if (!title_id) return; >- return myFetch(apiUrl, { >- headers: { >- "x-koha-embed": "resources,resources.package", >- }, >- }); >-}; >-export const fetchEBSCOTitle = function (title_id) { >- const apiUrl = "/api/v1/erm/eholdings/ebsco/titles/" + title_id; >- return _fetchTitle(apiUrl, title_id); >-}; >- >-export const _fetchResource = function (apiUrl, resource_id) { >- if (!resource_id) return; >- return myFetch(apiUrl, { >- headers: { >- "x-koha-embed": "title,package,vendor", >- }, >- }); >-}; >-export const fetchEBSCOResource = function (resource_id) { >- const apiUrl = "/api/v1/erm/eholdings/ebsco/resources/" + resource_id; >- return _fetchResource(apiUrl, resource_id); >-}; >- >-export const _fetchResources = async function (apiUrl) { >- return await myFetch(apiUrl); >-}; >- >-export const fetchEBSCOResources = function () { >- const apiUrl = "/api/v1/erm/eholdings/ebsco/resources"; >- return _fetchResources(apiUrl); >-}; >- >-export const myFetch = async function (url, options, return_response) { >- let r; >- await fetch(url, options || {}) >- .then((response) => checkError(response, return_response)) >- .then( >- (result) => { >- r = result; >- }, >- (error) => { >- setError(error.toString()); >- } >- ) >- .catch((error) => { >- setError(error); >- }); >- return r; >-}; >-export const myFetchTotal = async function (url, options) { >- let r; >- await myFetch(url, options, 1).then( >- (response) => { >- if (response) { >- r = response.headers.get("X-Total-Count"); >- } >- }, >- (error) => { >- setError(error.toString()); >- } >- ); >- return r; >-}; >- >-export const checkError = function (response, return_response) { >- if (response.status >= 200 && response.status <= 299) { >- return return_response ? response : response.json(); >- } else { >- console.log("Server returned an error:"); >- console.log(response); >- throw Error("%s (%s)".format(response.statusText, response.status)); >- } >-}; >-- >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