From 84a7e3ec7b7a6d5f859e55010298a53461af5bee Mon Sep 17 00:00:00 2001 From: Malte Grosse Date: Thu, 1 Feb 2024 11:24:16 +0100 Subject: [PATCH] changed api call --- theme/static/js/jhapi.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/theme/static/js/jhapi.js b/theme/static/js/jhapi.js index ba3c7a5..b91bdff 100644 --- a/theme/static/js/jhapi.js +++ b/theme/static/js/jhapi.js @@ -40,6 +40,12 @@ define(["jquery", "utils"], function ($, utils) { "api", utils.encode_uri_components(path), ); + var token = window.jhdata.xsrf_token + if (token) { + // add xsrf token to url parameter + var sep = url.indexOf("?") === -1 ? "?" : "&"; + url = url + sep + "_xsrf=" + token; + } $.ajax(url, options); };