This commit is contained in:
Benjamin Toby 2026-01-01 09:56:54 +01:00
parent b07153673e
commit a8128c23ab
3 changed files with 7 additions and 1 deletions

View File

@ -48,6 +48,8 @@ export default async function fetchApi<
let fetchOptions: RequestInit = {};
try {
fetchOptions.method = options.method;
if (options.method.match(/post|put|delete|patch/i)) {
if (options.body && typeof options.body == "object") {
fetchOptions.body = JSON.stringify(options.body);
@ -56,6 +58,8 @@ export default async function fetchApi<
fetchOptions.headers = _.merge(finalHeaders, options.headers || {});
fetchOptions = _.merge(fetchOptions, options.fetchOptions);
fetchData = await fetch(url, fetchOptions);
data = fetchData.json();
} catch (error: any) {

View File

@ -52,12 +52,14 @@ function fetchApi(url, options) {
let fetchData;
let fetchOptions = {};
try {
fetchOptions.method = options.method;
if (options.method.match(/post|put|delete|patch/i)) {
if (options.body && typeof options.body == "object") {
fetchOptions.body = JSON.stringify(options.body);
}
}
fetchOptions.headers = lodash_1.default.merge(finalHeaders, options.headers || {});
fetchOptions = lodash_1.default.merge(fetchOptions, options.fetchOptions);
fetchData = yield fetch(url, fetchOptions);
data = fetchData.json();
}

View File

@ -1,6 +1,6 @@
{
"name": "@moduletrace/datasquirel",
"version": "5.7.13",
"version": "5.7.14",
"description": "Cloud-based SQL data management tool",
"main": "dist/index.js",
"bin": {