Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: disable fetch timeout

thecodrr4a6e3cf7749c
diff --git a/packages/core/utils/http.js b/packages/core/utils/http.js
index bcba6d3e3..228837d5a 100644
--- a/packages/core/utils/http.js
+++ b/packages/core/utils/http.js
@@ -63,10 +63,9 @@ async function handleResponse(response) {
async function request(url, token, method) {
return handleResponse(
- await fetchWithTimeout(url, {
+ await fetch(url, {
method,
headers: getAuthorizationHeader(token),
- timeout: 20 * 1000,
})
);
}
@@ -79,14 +78,13 @@ async function bodyRequest(
contentType = "application/x-www-form-urlencoded"
) {
return handleResponse(
- await fetchWithTimeout(url, {
+ await fetch(url, {
method,
body: transformer(data, contentType),
headers: {
...getAuthorizationHeader(token),
"Content-Type": contentType,
},
- timeout: 20 * 1000,
})
);
}
@@ -118,26 +116,26 @@ function errorTransformer(errorJson) {
}
}
-/**
- *
- * @param {RequestInfo} resource
- * @param {RequestInit} options
- * @returns
- */
-async function fetchWithTimeout(resource, options = {}) {
- try {
- const { timeout = 8000 } = options;
-
- const controller = new AbortController();
- const id = setTimeout(() => controller.abort(), timeout);
- const response = await fetch(resource, {
- ...options,
- signal: controller.signal,
- });
- clearTimeout(id);
- return response;
- } catch (e) {
- if (e.name === "AbortError") throw new Error("Request timed out.");
- throw e;
- }
-}
+// /**
+// *
+// * @param {RequestInfo} resource
+// * @param {RequestInit} options
+// * @returns
+// */
+// async function fetchWithTimeout(resource, options = {}) {
+// try {
+// const { timeout = 8000 } = options;
+
+// const controller = new AbortController();
+// const id = setTimeout(() => controller.abort(), timeout);
+// const response = await fetch(resource, {
+// ...options,
+// signal: controller.signal,
+// });
+// clearTimeout(id);
+// return response;
+// } catch (e) {
+// if (e.name === "AbortError") throw new Error("Request timed out.");
+// throw e;
+// }
+// }