From 2476369f2f8d148ef450604dc8fba7b4ac227916 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 20 Mar 2025 12:07:04 +0100 Subject: [PATCH] Bug 38993: Fix sysprefs fetch from cypress Conflict between bug 38993 and bug 36025 We pass the token in the header, and retrieve it from the meta tag. --- .../prog/js/fetch/system-preferences-api-client.js | 5 ++--- t/cypress/support/e2e.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/system-preferences-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/system-preferences-api-client.js index 39c27925fd6..49b2f3212bb 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/system-preferences-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/system-preferences-api-client.js @@ -14,10 +14,9 @@ export class SysprefAPIClient { update: (variable, value) => this.httpClient.post({ endpoint: "", - body: "pref_%s=%s&csrf_token=%s".format( + body: "pref_%s=%s".format( encodeURIComponent(variable), - encodeURIComponent(value), - csrf_token + encodeURIComponent(value) ), headers: { "Content-Type": diff --git a/t/cypress/support/e2e.js b/t/cypress/support/e2e.js index 37dc1c750fa..269f5eabd56 100644 --- a/t/cypress/support/e2e.js +++ b/t/cypress/support/e2e.js @@ -1818,7 +1818,7 @@ mysql.addCommands(); Cypress.Commands.add("set_syspref", (variable, value) => { cy.window().then(win => { - const client = win.APIClient.syspref; + const client = win.APIClient.sysprefs; return client.sysprefs.update(variable, value); }); }); -- 2.34.1