You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
918 B

define(["/static/app/DA-ITSI-CP-vmware-dashboards/swc-vmware-cp/index.js", "/static/app/DA-ITSI-CP-vmware-dashboards/libs/jquery_private.js"], function(index, $) {
// Update CSRF token value from the cookie with JQuery ajaxPrefilter for CSRF validation
// Below block of code is required while using jQuery if the js code uses service.post() which requires CSRF validation with POST.
var HEADER_NAME = 'X-Splunk-Form-Key';
var FORM_KEY = index.SplunkUtil.getFormKey();
if (!FORM_KEY) {
return;
}
if ($) {
$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
if (options['type'] && options['type'].toUpperCase() == 'GET') return;
FORM_KEY = index.SplunkUtil.getFormKey();
jqXHR.setRequestHeader(HEADER_NAME, FORM_KEY);
});
}
// Raw jQuery does not return anything, so return it explicitly here.
return jQuery;
})