nextemos 4.1.3 → 4.1.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.
@@ -44,21 +44,26 @@ const fetchRequest = () => {
44
44
  if (method === __1.HTTPMethod.POST)
45
45
  options.headers = Object.assign({ ['Content-Type']: 'application/json' }, options.headers);
46
46
  const requestOptions = Object.assign(Object.assign({ cache: process.env.CACHE_STRATEGY || "no-store" }, options), { method });
47
- const metholInfo = () => {
48
- switch (method) {
49
- case __1.HTTPMethod.GET:
50
- return chalk_1.default.bgBlue.blueBright.bold(` ${method} => `);
51
- case __1.HTTPMethod.POST:
52
- return chalk_1.default.bgGreen.greenBright.bold(` ${method} => `);
53
- case __1.HTTPMethod.PUT:
54
- return chalk_1.default.bgYellowBright.yellow.bold(` ${method} => `);
55
- case __1.HTTPMethod.DELETE:
56
- return chalk_1.default.bgRedBright.red.bold(` ${method} => `);
57
- default:
58
- break;
59
- }
60
- };
61
- console.log(metholInfo() + chalk_1.default.bgWhite.black(apiURL) + " - " + JSON.stringify(requestOptions));
47
+ if (window !== undefined) {
48
+ const metholInfo = () => {
49
+ switch (method) {
50
+ case __1.HTTPMethod.GET:
51
+ return chalk_1.default.bgBlue.blueBright.bold(` ${method} => `);
52
+ case __1.HTTPMethod.POST:
53
+ return chalk_1.default.bgGreen.greenBright.bold(` ${method} => `);
54
+ case __1.HTTPMethod.PUT:
55
+ return chalk_1.default.bgYellowBright.yellow.bold(` ${method} => `);
56
+ case __1.HTTPMethod.DELETE:
57
+ return chalk_1.default.bgRedBright.red.bold(` ${method} => `);
58
+ default:
59
+ break;
60
+ }
61
+ };
62
+ console.log(metholInfo() + chalk_1.default.bgWhite.black(apiURL) + " - " + JSON.stringify(requestOptions));
63
+ }
64
+ else {
65
+ console.log(method + " => - " + apiURL + " - " + JSON.stringify(requestOptions));
66
+ }
62
67
  try {
63
68
  const response = yield fetch(apiURL.toString(), requestOptions);
64
69
  // Headers nesnesini Object'e dönüştürme
@@ -78,7 +83,10 @@ const fetchRequest = () => {
78
83
  }
79
84
  // response data nesnesini JSON'a dönüştürme.
80
85
  const responseData = yield response.json().catch(() => ({}));
81
- console.log(chalk_1.default.bgGreen.white.bold("Response is successfully..."));
86
+ if (window !== undefined)
87
+ console.log(chalk_1.default.bgGreen.white.bold("Response is successfully..."));
88
+ else
89
+ console.log("Response is successfully...");
82
90
  return {
83
91
  status: response.status,
84
92
  data: responseData,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "4.1.3",
3
+ "version": "4.1.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",