This commit is contained in:
2026-01-01 09:52:53 +01:00
parent bd507eb9ea
commit b07153673e
3 changed files with 12 additions and 8 deletions
+6 -4
View File
@@ -44,12 +44,12 @@ export default async function fetchApi<
data = null;
}
} else if (typeof options === "object") {
try {
let fetchData;
let fetchOptions: RequestInit = {};
let fetchData;
let fetchOptions: RequestInit = {};
try {
if (options.method.match(/post|put|delete|patch/i)) {
if (options.body && typeof options.body === "object") {
if (options.body && typeof options.body == "object") {
fetchOptions.body = JSON.stringify(options.body);
}
}
@@ -60,6 +60,8 @@ export default async function fetchApi<
data = fetchData.json();
} catch (error: any) {
console.log("FetchAPI error #2:", error.message);
console.log("fetchData =>", fetchData);
console.log("fetchOptions =>", fetchOptions);
data = null;
}
} else {