nextemos 5.5.11 → 5.5.12

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,7 +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, _c;
41
+ var _b;
42
42
  var { url, method, params } = _a, options = __rest(_a, ["url", "method", "params"]);
43
43
  const apiURL = new URL(url);
44
44
  if (params) {
@@ -59,10 +59,13 @@ const fetchRequest = () => {
59
59
  method === __1.HTTPMethod.DELETE) {
60
60
  options.headers = Object.assign({ ["Content-Type"]: "application/json" }, options.headers);
61
61
  // if output-cache-key is in headers, append it to the body
62
- const bodyWithOutputCacheKey = Object.assign(Object.assign({}, (typeof options.body === "string"
63
- ? JSON.parse(options.body || "{}")
64
- : {})), { outputCacheKey: (_b = options.headers) === null || _b === void 0 ? void 0 : _b["output-cache-key"] });
65
- options.body = JSON.stringify(bodyWithOutputCacheKey);
62
+ const outputCacheKey = options.headers &&
63
+ options.headers["output-cache-key"];
64
+ if (outputCacheKey) {
65
+ options.body = JSON.stringify(Object.assign(Object.assign({}, (typeof options.body === "string"
66
+ ? JSON.parse(options.body || "{}")
67
+ : {})), (outputCacheKey ? { outputCacheKey } : {})));
68
+ }
66
69
  }
67
70
  // İstek seçeneklerini oluştur
68
71
  const requestOptions = Object.assign(Object.assign({}, options), { method });
@@ -91,7 +94,7 @@ const fetchRequest = () => {
91
94
  console.log("Fetch Error: ", {
92
95
  apiUrl: apiURL.toString(),
93
96
  status: response.status,
94
- errorMessage: ((_c = JSON.parse(errorDetail || "{}")) === null || _c === void 0 ? void 0 : _c.message) || errorDetail,
97
+ errorMessage: ((_b = JSON.parse(errorDetail || "{}")) === null || _b === void 0 ? void 0 : _b.message) || errorDetail,
95
98
  });
96
99
  return {
97
100
  status: response.status,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "5.5.11",
3
+ "version": "5.5.12",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",