mirror of https://github.com/jumpserver/jumpserver
parent
24a1738e73
commit
8ae98887ee
|
@ -98,6 +98,9 @@ function doRequestAuth() {
|
||||||
},
|
},
|
||||||
error: function (text, data) {
|
error: function (text, data) {
|
||||||
},
|
},
|
||||||
|
beforeSend: function(request) {
|
||||||
|
request.setRequestHeader("X-JMS-LOGIN-TYPE", "W");
|
||||||
|
},
|
||||||
flash_message: false, // 是否显示flash消息
|
flash_message: false, // 是否显示flash消息
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,6 @@ function setAjaxCSRFToken() {
|
||||||
|
|
||||||
$.ajaxSetup({
|
$.ajaxSetup({
|
||||||
beforeSend: function (xhr, settings) {
|
beforeSend: function (xhr, settings) {
|
||||||
xhr.setRequestHeader("X-JMS-LOGIN-TYPE", "W");
|
|
||||||
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
|
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
|
||||||
xhr.setRequestHeader("X-CSRFToken", csrftoken);
|
xhr.setRequestHeader("X-CSRFToken", csrftoken);
|
||||||
}
|
}
|
||||||
|
@ -271,11 +270,13 @@ function requestApi(props) {
|
||||||
if (typeof(dataBody) === "object") {
|
if (typeof(dataBody) === "object") {
|
||||||
dataBody = JSON.stringify(dataBody)
|
dataBody = JSON.stringify(dataBody)
|
||||||
}
|
}
|
||||||
|
var beforeSend = props.beforeSend || function (request) {}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: props.url,
|
url: props.url,
|
||||||
type: props.method || "PATCH",
|
type: props.method || "PATCH",
|
||||||
data: dataBody,
|
data: dataBody,
|
||||||
|
beforeSend: beforeSend,
|
||||||
contentType: props.content_type || "application/json; charset=utf-8",
|
contentType: props.content_type || "application/json; charset=utf-8",
|
||||||
dataType: props.data_type || "json"
|
dataType: props.data_type || "json"
|
||||||
}).done(function (data, textStatue, jqXHR) {
|
}).done(function (data, textStatue, jqXHR) {
|
||||||
|
|
Loading…
Reference in New Issue