nextemos 5.8.1 → 5.8.3

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.
@@ -53,21 +53,22 @@ const fetchRequest = () => {
53
53
  }
54
54
  });
55
55
  }
56
+ const isPreview = (options === null || options === void 0 ? void 0 : options.headers)["Preview"];
57
+ // if preview is in headers, append it to the params
58
+ if (isPreview)
59
+ apiURL.searchParams.append("preview", "true");
56
60
  if ((method === __1.HTTPMethod.POST &&
57
61
  (!options.body || typeof options.body === "string")) ||
58
62
  method === __1.HTTPMethod.PUT ||
59
63
  method === __1.HTTPMethod.DELETE) {
60
64
  options.headers = Object.assign({ ["Content-Type"]: "application/json" }, options.headers);
61
65
  // if output-cache-key is in headers, append it to the body
62
- const outputCacheKey = options.headers &&
63
- options.headers["output-cache-key"];
66
+ const outputCacheKey = options.headers["output-cache-key"];
64
67
  if (outputCacheKey) {
65
68
  options.body = JSON.stringify(Object.assign(Object.assign({}, (typeof options.body === "string"
66
69
  ? JSON.parse(options.body || "{}")
67
70
  : {})), (outputCacheKey ? { outputCacheKey } : {})));
68
71
  }
69
- const isPreview = options.headers &&
70
- options.headers["Preview"];
71
72
  if (isPreview) {
72
73
  options.body = JSON.stringify(Object.assign(Object.assign({}, (typeof options.body === "string"
73
74
  ? JSON.parse(options.body || "{}")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "5.8.1",
3
+ "version": "5.8.3",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",