Bugzilla – Attachment 147060 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: Set the default header at lower level
Bug-32939-Set-the-default-header-at-lower-level.patch (text/plain), 3.01 KB, created by
Matt Blenkinsop
on 2023-02-21 16:15:15 UTC
(
hide
)
Description:
Bug 32939: Set the default header at lower level
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2023-02-21 16:15:15 UTC
Size:
3.01 KB
patch
obsolete
>From 62a80f213c1c4b2e8463794a35965923bef5c45a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 15 Feb 2023 10:13:58 +0100 >Subject: [PATCH] Bug 32939: Set the default header at lower level > >Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >--- > .../intranet-tmpl/prog/js/vue/fetch/erm-api-client.js | 5 +---- > .../intranet-tmpl/prog/js/vue/fetch/http-client.js | 10 ++++------ > 2 files changed, 5 insertions(+), 10 deletions(-) > >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 bdad9f6b179..e16e35b2b55 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 >@@ -24,23 +24,20 @@ export class ERMAPIClient extends HttpClient { > delete: (id) => > this.delete({ > endpoint: "agreements/" + id, >- headers: this.getDefaultJSONPayloadHeader(), > }), > create: (agreement) => > this.post({ > endpoint: "agreements", > body: agreement, >- headers: this.getDefaultJSONPayloadHeader(), > }), > update: (agreement, id) => > this.put({ > endpoint: "agreements/" + id, > body: agreement, >- headers: this.getDefaultJSONPayloadHeader(), > }), > //count: () => this.count("agreements"), //TODO: Implement count method > }; > } > } > >-export default ERMAPIClient; >\ No newline at end of file >+export default ERMAPIClient; >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 6a47276dcf2..63731a5657a 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 >@@ -1,12 +1,15 @@ > class HttpClient { > constructor(options = {}) { > this._baseURL = options.baseURL || ""; >+ this._headers = options.headers || { >+ "Content-Type": "application/json;charset=utf-8", >+ }; > } > > async _fetchJSON(endpoint, headers = {}, options = {}) { > const res = await fetch(this._baseURL + endpoint, { > ...options, >- headers: headers, >+ headers: { ...this._headers, ...headers }, > }); > > if (!res.ok) throw new Error(res.statusText); >@@ -18,7 +21,6 @@ class HttpClient { > } > > get(params = {}) { >- console.log(params); > return this._fetchJSON(params.endpoint, params.headers, { > ...params.options, > method: "GET", >@@ -50,10 +52,6 @@ class HttpClient { > } > > //TODO: Implement count method >- >- getDefaultJSONPayloadHeader() { >- return { "Content-Type": "application/json;charset=utf-8" }; >- } > } > > export default HttpClient; >-- >2.37.1 (Apple Git-137.1)
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