nextemos 4.1.7 → 4.1.9

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.
@@ -19,12 +19,8 @@ var __rest = (this && this.__rest) || function (s, e) {
19
19
  }
20
20
  return t;
21
21
  };
22
- var __importDefault = (this && this.__importDefault) || function (mod) {
23
- return (mod && mod.__esModule) ? mod : { "default": mod };
24
- };
25
22
  Object.defineProperty(exports, "__esModule", { value: true });
26
23
  const __1 = require("../");
27
- const consola_1 = __importDefault(require("consola"));
28
24
  /**
29
25
  * İstek yapmak için bir HTTP istemcisi oluşturur.
30
26
  * @returns {object} İstek yapmak için yöntemlere sahip HTTP istemcisi.
@@ -44,7 +40,7 @@ const fetchRequest = () => {
44
40
  if (method === __1.HTTPMethod.POST)
45
41
  options.headers = Object.assign({ ['Content-Type']: 'application/json' }, options.headers);
46
42
  const requestOptions = Object.assign(Object.assign({ cache: process.env.CACHE_STRATEGY || "no-store" }, options), { method });
47
- consola_1.default.debug(`${method} => - ${apiURL} - ${JSON.stringify(requestOptions)}`);
43
+ console.log(`Fetch Request: ${method} - ${apiURL} - ${JSON.stringify(requestOptions)}`);
48
44
  try {
49
45
  const response = yield fetch(apiURL.toString(), requestOptions);
50
46
  // Headers nesnesini Object'e dönüştürme
@@ -64,7 +60,6 @@ const fetchRequest = () => {
64
60
  }
65
61
  // response data nesnesini JSON'a dönüştürme.
66
62
  const responseData = yield response.json().catch(() => ({}));
67
- consola_1.default.success("Response is successfully...");
68
63
  return {
69
64
  status: response.status,
70
65
  data: responseData,
@@ -73,14 +68,14 @@ const fetchRequest = () => {
73
68
  }
74
69
  catch (error) {
75
70
  if (error instanceof Error) {
76
- consola_1.default.error(`Fetch Request Exception Error! -> ${apiURL} -> ${error.name} : ${error.message}`);
71
+ console.log(`Fetch Request Exception Error! -> ${apiURL} -> ${error.name} : ${error.message}`);
77
72
  return {
78
73
  status: 500,
79
74
  error: error.name,
80
75
  errorMessage: error.message
81
76
  };
82
77
  }
83
- consola_1.default.error(`Fetch Request Exception Unknown Error! ->`, error);
78
+ console.log(`Fetch Request Exception Unknown Error! ->`, error);
84
79
  return {
85
80
  status: 500,
86
81
  error: `${error}`,
@@ -51,12 +51,21 @@ exports.MemberService = {
51
51
  },
52
52
  SendMessage: function (data, options) {
53
53
  return __awaiter(this, void 0, void 0, function* () {
54
+ const formData = new FormData();
55
+ Object.keys(data).forEach((key) => {
56
+ const value = data[key];
57
+ if (value !== undefined && value !== null) {
58
+ formData.append(key, value.toString());
59
+ }
60
+ });
54
61
  return yield (0, __1.fetchRequest)().post((0, urls_1.getUrl)({
55
62
  serviceUrl: this.ServiceUrl,
56
63
  prefix: this.Prefix,
57
64
  isClient: options === null || options === void 0 ? void 0 : options.useClient,
58
65
  methodName: urls_1.default.Member.MemberMessages.Messages,
59
- }), Object.assign(Object.assign({}, options), { body: JSON.stringify(data) }));
66
+ }), Object.assign({ headers: {
67
+ 'Content-Type': 'multipart/form-data'
68
+ }, body: formData }, options));
60
69
  });
61
70
  },
62
71
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "4.1.7",
3
+ "version": "4.1.9",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -38,7 +38,6 @@
38
38
  "nextemos"
39
39
  ],
40
40
  "dependencies": {
41
- "consola": "^3.2.3",
42
41
  "html-entities": "^2.5.2"
43
42
  }
44
43
  }