Updates
This commit is contained in:
Vendored
+4
-11
@@ -51,19 +51,12 @@ function fetchApi(url, options) {
|
||||
else if (typeof options === "object") {
|
||||
try {
|
||||
let fetchData;
|
||||
let fetchOptions = {};
|
||||
if (options.body && typeof options.body === "object") {
|
||||
let oldOptionsBody = lodash_1.default.cloneDeep(options.body);
|
||||
options.body = JSON.stringify(oldOptionsBody);
|
||||
}
|
||||
if (options.headers) {
|
||||
options.headers = lodash_1.default.merge(options.headers, finalHeaders);
|
||||
const finalOptions = Object.assign({}, options);
|
||||
fetchData = yield fetch(url, finalOptions);
|
||||
}
|
||||
else {
|
||||
const finalOptions = Object.assign(Object.assign({}, options), { headers: finalHeaders });
|
||||
fetchData = yield fetch(url, finalOptions);
|
||||
fetchOptions.body = JSON.stringify(options.body);
|
||||
}
|
||||
fetchOptions.headers = lodash_1.default.merge(finalHeaders, options.headers || {});
|
||||
fetchData = yield fetch(url, fetchOptions);
|
||||
data = fetchData.json();
|
||||
}
|
||||
catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user