Bugzilla – Attachment 179550 Details for
Bug 38993
Merge fetch files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38993: Send CSRF token for Vue fetches
Bug-38993-Send-CSRF-token-for-Vue-fetches.patch (text/plain), 2.21 KB, created by
Jonathan Druart
on 2025-03-20 15:40:15 UTC
(
hide
)
Description:
Bug 38993: Send CSRF token for Vue fetches
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-03-20 15:40:15 UTC
Size:
2.21 KB
patch
obsolete
>From 232f1117ee4f24f020f45cfc550a76ff76448d2c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 20 Mar 2025 16:39:30 +0100 >Subject: [PATCH] Bug 38993: Send CSRF token for Vue fetches > >We need it for syspref at least. >--- > .../intranet-tmpl/prog/js/vue/fetch/http-client.js | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > >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 ffee1ce979d..abb4b9e6fbd 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 >@@ -6,6 +6,7 @@ class HttpClient { > this._headers = options.headers || { > "Content-Type": "application/json;charset=utf-8", > }; >+ this.csrf_token = $('meta[name="csrf-token"]').attr("content"); > } > > async _fetchJSON( >@@ -83,9 +84,11 @@ class HttpClient { > ? params.body > : JSON.stringify(params.body) > : undefined; >+ let csrf_token = { "CSRF-TOKEN": this.csrf_token }; >+ let headers = { ...csrf_token, ...params.headers }; > return this._fetchJSON( > params.endpoint, >- params.headers, >+ headers, > { > ...params.options, > body, >@@ -102,9 +105,11 @@ class HttpClient { > ? params.body > : JSON.stringify(params.body) > : undefined; >+ let csrf_token = { "CSRF-TOKEN": this.csrf_token }; >+ let headers = { ...csrf_token, ...params.headers }; > return this._fetchJSON( > params.endpoint, >- params.headers, >+ headers, > { > ...params.options, > body, >@@ -116,9 +121,11 @@ class HttpClient { > } > > delete(params = {}) { >+ let csrf_token = { "CSRF-TOKEN": this.csrf_token }; >+ let headers = { ...csrf_token, ...params.headers }; > return this._fetchJSON( > params.endpoint, >- params.headers, >+ headers, > { > parseResponse: false, > ...params.options, >-- >2.34.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 38993
:
177316
|
177317
|
177318
|
177337
|
177338
|
177339
|
177342
|
177343
|
177344
|
177345
|
177346
|
177347
|
177348
|
179100
|
179101
|
179102
|
179103
|
179106
|
179107
|
179108
|
179109
|
179513
| 179550