nextemos 5.2.13 → 5.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,6 +38,7 @@ const fetchRequest = () => {
38
38
  * @returns {Promise<IApiResponse<T>>} API'den gelen yanıt.
39
39
  */
40
40
  const request = (_a) => __awaiter(void 0, void 0, void 0, function* () {
41
+ var _b;
41
42
  var { url, method, params } = _a, options = __rest(_a, ["url", "method", "params"]);
42
43
  const apiURL = new URL(url);
43
44
  if (params) {
@@ -83,10 +84,9 @@ const fetchRequest = () => {
83
84
  const errorDetail = yield response.text();
84
85
  if (["debug", "info", "trace"].includes(FETCH_OPTIONS.LOG_LEVEL))
85
86
  console.log("Fetch Error: ", {
86
- api: apiURL,
87
87
  apiUrl: apiURL.toString(),
88
88
  status: response.status,
89
- errorMessage: errorDetail,
89
+ errorMessage: ((_b = JSON.parse(errorDetail || "{}")) === null || _b === void 0 ? void 0 : _b.message) || errorDetail,
90
90
  });
91
91
  return {
92
92
  status: response.status,
@@ -115,7 +115,10 @@ const fetchRequest = () => {
115
115
  }
116
116
  catch (error) {
117
117
  if (error instanceof Error) {
118
- console.log(`Fetch Request Exception Error! -> ${apiURL.toString()} -> ${apiURL} -> ${error.name} : ${error.message}`);
118
+ console.log("Fetch Request Exception Error!", {
119
+ apiURL: apiURL.toString(),
120
+ error,
121
+ });
119
122
  return {
120
123
  status: 500,
121
124
  error: error.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "5.2.13",
3
+ "version": "5.2.14",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",