Added support for FormData in JS API facade
This commit is contained in:
parent
d8d65ed24c
commit
77c51d9a8a
1 changed files with 7 additions and 2 deletions
|
@ -73,7 +73,7 @@ App.API = function(_, jQuery, promise, appState) {
|
||||||
|
|
||||||
var xhr = null;
|
var xhr = null;
|
||||||
var apiPromise = promise.make(function(resolve, reject) {
|
var apiPromise = promise.make(function(resolve, reject) {
|
||||||
xhr = jQuery.ajax({
|
var options = {
|
||||||
headers: {
|
headers: {
|
||||||
'X-Authorization-Token': appState.get('loginToken') || '',
|
'X-Authorization-Token': appState.get('loginToken') || '',
|
||||||
},
|
},
|
||||||
|
@ -93,7 +93,12 @@ App.API = function(_, jQuery, promise, appState) {
|
||||||
url: fullUrl,
|
url: fullUrl,
|
||||||
data: data,
|
data: data,
|
||||||
cache: false,
|
cache: false,
|
||||||
});
|
};
|
||||||
|
if (data instanceof FormData) {
|
||||||
|
options.processData = false;
|
||||||
|
options.contentType = false;
|
||||||
|
}
|
||||||
|
xhr = jQuery.ajax(options);
|
||||||
});
|
});
|
||||||
apiPromise.xhr = xhr;
|
apiPromise.xhr = xhr;
|
||||||
return apiPromise;
|
return apiPromise;
|
||||||
|
|
Loading…
Reference in a new issue