nextemos 5.8.2 → 5.8.4

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.
@@ -41,7 +41,6 @@ const fetchRequest = () => {
41
41
  var _b;
42
42
  var { url, method, params } = _a, options = __rest(_a, ["url", "method", "params"]);
43
43
  const apiURL = new URL(url);
44
- const isPreview = (options === null || options === void 0 ? void 0 : options.headers)["Preview"];
45
44
  if (params) {
46
45
  Object.keys(params).forEach((key) => {
47
46
  if (Array.isArray(params[key])) {
@@ -53,9 +52,11 @@ const fetchRequest = () => {
53
52
  apiURL.searchParams.append(key, params[key]);
54
53
  }
55
54
  });
56
- // if preview is in headers, append it to the params
57
- if (isPreview)
58
- params.preview = true;
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 && method === __1.HTTPMethod.GET) {
59
+ apiURL.searchParams.append("preview", "true");
59
60
  }
60
61
  if ((method === __1.HTTPMethod.POST &&
61
62
  (!options.body || typeof options.body === "string")) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "5.8.2",
3
+ "version": "5.8.4",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",