contentoh-components-library 21.3.18 → 21.3.19
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.
- package/.env.development +0 -5
- package/dist/assets/images/generalButton/closeIcon.svg +2 -2
- package/dist/components/atoms/GeneralInput/index.js +14 -1
- package/dist/components/atoms/ProgressBar/index.js +6 -36
- package/dist/components/atoms/ProgressBar/styles.js +3 -11
- package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +22 -21
- package/dist/components/molecules/CustomSelect/SelectItem.js +1 -10
- package/dist/components/molecules/HeaderTop/index.js +6 -23
- package/dist/components/molecules/HeaderTop/styles.js +1 -1
- package/dist/components/molecules/ProductNameHeader/index.js +4 -6
- package/dist/components/organisms/FullProductNameHeader/index.js +0 -1
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +50 -65
- package/dist/components/pages/ProviderProductEdition/index.js +11 -15
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +44 -36
- package/dist/components/pages/RetailerProductEdition/index.js +12 -13
- package/dist/global-files/data.js +23 -18
- package/dist/global-files/fonts.css +0 -6
- package/dist/global-files/variables.js +0 -2
- package/dist/index.js +46 -267
- package/package.json +1 -12
- package/src/assets/images/generalButton/closeIcon.svg +2 -2
- package/src/components/atoms/GeneralInput/index.js +10 -0
- package/src/components/atoms/ProgressBar/index.js +5 -40
- package/src/components/atoms/ProgressBar/styles.js +0 -24
- package/src/components/molecules/CustomSelect/CustomSelect.stories.js +12 -20
- package/src/components/molecules/CustomSelect/SelectItem.js +0 -7
- package/src/components/molecules/HeaderTop/index.js +8 -29
- package/src/components/molecules/HeaderTop/styles.js +0 -4
- package/src/components/molecules/ProductNameHeader/index.js +2 -7
- package/src/components/organisms/FullProductNameHeader/index.js +0 -1
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +49 -67
- package/src/components/pages/ProviderProductEdition/index.js +9 -16
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +46 -36
- package/src/components/pages/RetailerProductEdition/index.js +10 -14
- package/src/global-files/data.js +23 -18
- package/src/global-files/fonts.css +0 -6
- package/src/global-files/variables.js +0 -2
- package/src/index.js +0 -17
- package/dist/assets/images/customSelect/starIcon.svg +0 -14
- package/dist/assets/images/defaultImages/Spinner.gif +0 -0
- package/dist/assets/images/defaultImages/notFound.svg +0 -124
- package/dist/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +0 -72
- package/dist/components/atoms/ButtonFileChooser/index.js +0 -110
- package/dist/components/atoms/ButtonFileChooser/styles.js +0 -20
- package/dist/components/atoms/ButtonV2/ButtonV2.stories.js +0 -66
- package/dist/components/atoms/ButtonV2/index.js +0 -110
- package/dist/components/atoms/ButtonV2/styles.js +0 -53
- package/dist/components/atoms/CustomIcon/CustomIcon.stories.js +0 -50
- package/dist/components/atoms/CustomIcon/index.js +0 -40
- package/dist/components/atoms/CustomIcon/styles.js +0 -33
- package/dist/components/atoms/IconFile/IconFile.stories.js +0 -48
- package/dist/components/atoms/IconFile/index.js +0 -249
- package/dist/components/atoms/IconFile/styles.js +0 -23
- package/dist/components/atoms/Image/Image.stories.js +0 -73
- package/dist/components/atoms/Image/index.js +0 -76
- package/dist/components/atoms/Image/styles.js +0 -43
- package/dist/components/atoms/ImageLink/ImageLink.stories.js +0 -63
- package/dist/components/atoms/ImageLink/index.js +0 -77
- package/dist/components/atoms/ImageLink/styles.js +0 -40
- package/dist/components/atoms/ImagePreview/ImagePreview.stories.js +0 -70
- package/dist/components/atoms/ImagePreview/index.js +0 -208
- package/dist/components/atoms/ImagePreview/styles.js +0 -44
- package/dist/components/atoms/InputText/InputText.stories.js +0 -60
- package/dist/components/atoms/InputText/index.js +0 -66
- package/dist/components/atoms/InputText/styles.js +0 -32
- package/dist/components/atoms/NotFound/NotFound.stories.js +0 -36
- package/dist/components/atoms/NotFound/index.js +0 -75
- package/dist/components/atoms/NotFound/styles.js +0 -20
- package/dist/components/atoms/SelectItemV2/SelectItemV2.stories.js +0 -45
- package/dist/components/atoms/SelectItemV2/index.js +0 -57
- package/dist/components/atoms/SelectItemV2/styles.js +0 -30
- package/dist/components/atoms/Tooltip/Tooltip.stories.js +0 -66
- package/dist/components/atoms/Tooltip/index.js +0 -72
- package/dist/components/atoms/Tooltip/styles.js +0 -20
- package/dist/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +0 -66
- package/dist/components/molecules/ButtonDownloadFile/index.js +0 -179
- package/dist/components/molecules/ButtonDownloadFile/styles.js +0 -23
- package/dist/components/molecules/Dropdown/Dropdown.stories.js +0 -98
- package/dist/components/molecules/Dropdown/index.js +0 -150
- package/dist/components/molecules/Dropdown/styles.js +0 -26
- package/dist/components/molecules/ImageTooltip/ImageTooltip.stories.js +0 -82
- package/dist/components/molecules/ImageTooltip/index.js +0 -85
- package/dist/components/molecules/ImageTooltip/styles.js +0 -33
- package/dist/components/molecules/SelectV2/SelectV2.stories.js +0 -120
- package/dist/components/molecules/SelectV2/index.js +0 -306
- package/dist/components/molecules/SelectV2/styles.js +0 -42
- package/dist/components/molecules/SelectV2/test.js +0 -95
- package/dist/components/molecules/SelectV2/test.stories.js +0 -27
- package/dist/components/organisms/Chat/Chat.stories.js +0 -160
- package/dist/components/organisms/Chat/ChatLists/ChatLists.stories.js +0 -83
- package/dist/components/organisms/Chat/ChatLists/index.js +0 -160
- package/dist/components/organisms/Chat/ChatLists/styles.js +0 -29
- package/dist/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +0 -176
- package/dist/components/organisms/Chat/ContainerItems/index.js +0 -537
- package/dist/components/organisms/Chat/ContainerItems/styles.js +0 -20
- package/dist/components/organisms/Chat/ContentChat/ContentChat.stories.js +0 -142
- package/dist/components/organisms/Chat/ContentChat/index.js +0 -1429
- package/dist/components/organisms/Chat/ContentChat/styles.js +0 -20
- package/dist/components/organisms/Chat/Footer/Footer.stories.js +0 -43
- package/dist/components/organisms/Chat/Footer/index.js +0 -976
- package/dist/components/organisms/Chat/Footer/styles.js +0 -32
- package/dist/components/organisms/Chat/Header/Header.stories.js +0 -96
- package/dist/components/organisms/Chat/Header/index.js +0 -84
- package/dist/components/organisms/Chat/Header/styles.js +0 -20
- package/dist/components/organisms/Chat/index.js +0 -253
- package/dist/components/organisms/Chat/styles.js +0 -29
- package/dist/components/organisms/Modal/Modal.stories.js +0 -66
- package/dist/components/organisms/Modal/index.js +0 -95
- package/dist/components/organisms/Modal/styles.js +0 -20
- package/dist/components/organisms/RangeCalendar/RangeCalendar.stories.js +0 -33
- package/dist/components/organisms/RangeCalendar/index.js +0 -149
- package/dist/components/organisms/RangeCalendar/styles.js +0 -27
- package/dist/global-files/handle_http.js +0 -381
- package/dist/global-files/handle_userTech.js +0 -20
- package/dist/global-files/utils.js +0 -514
- package/src/assets/images/customSelect/starIcon.svg +0 -14
- package/src/assets/images/defaultImages/Spinner.gif +0 -0
- package/src/assets/images/defaultImages/notFound.svg +0 -124
- package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +0 -47
- package/src/components/atoms/ButtonFileChooser/index.js +0 -68
- package/src/components/atoms/ButtonFileChooser/styles.js +0 -4
- package/src/components/atoms/ButtonV2/ButtonV2.stories.js +0 -53
- package/src/components/atoms/ButtonV2/index.js +0 -85
- package/src/components/atoms/ButtonV2/styles.js +0 -217
- package/src/components/atoms/CustomIcon/CustomIcon.stories.js +0 -36
- package/src/components/atoms/CustomIcon/index.js +0 -41
- package/src/components/atoms/CustomIcon/styles.js +0 -85
- package/src/components/atoms/IconFile/IconFile.stories.js +0 -35
- package/src/components/atoms/IconFile/index.js +0 -119
- package/src/components/atoms/IconFile/styles.js +0 -67
- package/src/components/atoms/Image/Image.stories.js +0 -51
- package/src/components/atoms/Image/index.js +0 -55
- package/src/components/atoms/Image/styles.js +0 -34
- package/src/components/atoms/ImageLink/ImageLink.stories.js +0 -43
- package/src/components/atoms/ImageLink/index.js +0 -57
- package/src/components/atoms/ImageLink/styles.js +0 -30
- package/src/components/atoms/ImagePreview/ImagePreview.stories.js +0 -52
- package/src/components/atoms/ImagePreview/index.js +0 -178
- package/src/components/atoms/ImagePreview/styles.js +0 -77
- package/src/components/atoms/InputText/InputText.stories.js +0 -39
- package/src/components/atoms/InputText/index.js +0 -61
- package/src/components/atoms/InputText/styles.js +0 -89
- package/src/components/atoms/NotFound/NotFound.stories.js +0 -19
- package/src/components/atoms/NotFound/index.js +0 -52
- package/src/components/atoms/NotFound/styles.js +0 -55
- package/src/components/atoms/SelectItemV2/SelectItemV2.stories.js +0 -26
- package/src/components/atoms/SelectItemV2/index.js +0 -61
- package/src/components/atoms/SelectItemV2/styles.js +0 -90
- package/src/components/atoms/Tooltip/Tooltip.stories.js +0 -51
- package/src/components/atoms/Tooltip/index.js +0 -59
- package/src/components/atoms/Tooltip/styles.js +0 -42
- package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +0 -54
- package/src/components/molecules/ButtonDownloadFile/index.js +0 -109
- package/src/components/molecules/ButtonDownloadFile/styles.js +0 -66
- package/src/components/molecules/Dropdown/Dropdown.stories.js +0 -103
- package/src/components/molecules/Dropdown/index.js +0 -150
- package/src/components/molecules/Dropdown/styles.js +0 -75
- package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +0 -68
- package/src/components/molecules/ImageTooltip/index.js +0 -63
- package/src/components/molecules/ImageTooltip/styles.js +0 -18
- package/src/components/molecules/SelectV2/SelectV2.stories.js +0 -115
- package/src/components/molecules/SelectV2/index.js +0 -357
- package/src/components/molecules/SelectV2/styles.js +0 -105
- package/src/components/molecules/SelectV2/test.js +0 -61
- package/src/components/molecules/SelectV2/test.stories.js +0 -10
- package/src/components/organisms/Chat/Chat.stories.js +0 -147
- package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +0 -65
- package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
- package/src/components/organisms/Chat/ChatLists/index.js +0 -141
- package/src/components/organisms/Chat/ChatLists/styles.js +0 -162
- package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +0 -142
- package/src/components/organisms/Chat/ContainerItems/index.js +0 -512
- package/src/components/organisms/Chat/ContainerItems/styles.js +0 -328
- package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +0 -102
- package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
- package/src/components/organisms/Chat/ContentChat/index.js +0 -897
- package/src/components/organisms/Chat/ContentChat/styles.js +0 -41
- package/src/components/organisms/Chat/Footer/Footer.stories.js +0 -22
- package/src/components/organisms/Chat/Footer/index.js +0 -661
- package/src/components/organisms/Chat/Footer/styles.js +0 -286
- package/src/components/organisms/Chat/Header/Header.stories.js +0 -66
- package/src/components/organisms/Chat/Header/index.js +0 -94
- package/src/components/organisms/Chat/Header/styles.js +0 -49
- package/src/components/organisms/Chat/index.js +0 -235
- package/src/components/organisms/Chat/styles.js +0 -42
- package/src/components/organisms/Modal/Modal.stories.js +0 -55
- package/src/components/organisms/Modal/index.js +0 -97
- package/src/components/organisms/Modal/styles.js +0 -103
- package/src/components/organisms/RangeCalendar/RangeCalendar.stories.js +0 -16
- package/src/components/organisms/RangeCalendar/index.js +0 -121
- package/src/components/organisms/RangeCalendar/styles.js +0 -883
- package/src/global-files/handle_http.js +0 -225
- package/src/global-files/handle_userTech.js +0 -7
- package/src/global-files/utils.js +0 -330
|
@@ -1,381 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.fetchPUT = exports.fetchPOST = exports.fetchGET = exports.fetchDELETE = void 0;
|
|
9
|
-
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
13
|
-
|
|
14
|
-
var _axios = _interopRequireDefault(require("axios"));
|
|
15
|
-
|
|
16
|
-
//============================================================
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* funcion que realiza un axios GET
|
|
20
|
-
*
|
|
21
|
-
* Si <body> es undefined significa que hubo error
|
|
22
|
-
|
|
23
|
-
* @returns { Promise<{
|
|
24
|
-
* body: {} | undefined ,
|
|
25
|
-
* message: string,
|
|
26
|
-
* errorDetail: string
|
|
27
|
-
* }> }
|
|
28
|
-
*
|
|
29
|
-
*/
|
|
30
|
-
//============================================================
|
|
31
|
-
var fetchGET = function fetchGET() {
|
|
32
|
-
var endpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
33
|
-
var paramsQuery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
34
|
-
var paramsHeaders = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
35
|
-
return new Promise( /*#__PURE__*/function () {
|
|
36
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(response) {
|
|
37
|
-
var URL, keysParamsQuery, respHTTPjson, body, _body$message, _body$errorDetail;
|
|
38
|
-
|
|
39
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
40
|
-
while (1) {
|
|
41
|
-
switch (_context.prev = _context.next) {
|
|
42
|
-
case 0:
|
|
43
|
-
_context.prev = 0;
|
|
44
|
-
URL = endpoint;
|
|
45
|
-
keysParamsQuery = Object.keys(paramsQuery); // agregar cada param query a la URL
|
|
46
|
-
|
|
47
|
-
keysParamsQuery.forEach(function (key, index) {
|
|
48
|
-
if (index == 0) {
|
|
49
|
-
URL += "?".concat(key, "=").concat(paramsQuery[key]);
|
|
50
|
-
} else {
|
|
51
|
-
URL += "&".concat(key, "=").concat(paramsQuery[key]);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
_context.next = 6;
|
|
55
|
-
return _axios.default.get(URL, {
|
|
56
|
-
headers: paramsHeaders
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
case 6:
|
|
60
|
-
respHTTPjson = _context.sent;
|
|
61
|
-
|
|
62
|
-
if (!(respHTTPjson.status !== 200)) {
|
|
63
|
-
_context.next = 9;
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return _context.abrupt("return", response({
|
|
68
|
-
message: "No fue posible llevar a cabo la operación",
|
|
69
|
-
errorDetail: respHTTPjson.statusText
|
|
70
|
-
}));
|
|
71
|
-
|
|
72
|
-
case 9:
|
|
73
|
-
// obtener body backend
|
|
74
|
-
body = JSON.parse(respHTTPjson.data.body); // verificar si existe error desde el backend
|
|
75
|
-
|
|
76
|
-
if (!(respHTTPjson.data.statusCode !== 200)) {
|
|
77
|
-
_context.next = 12;
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return _context.abrupt("return", response({
|
|
82
|
-
message: (_body$message = body.message) !== null && _body$message !== void 0 ? _body$message : "",
|
|
83
|
-
errorDetail: (_body$errorDetail = body.errorDetail) !== null && _body$errorDetail !== void 0 ? _body$errorDetail : ""
|
|
84
|
-
}));
|
|
85
|
-
|
|
86
|
-
case 12:
|
|
87
|
-
return _context.abrupt("return", response({
|
|
88
|
-
body: body
|
|
89
|
-
}));
|
|
90
|
-
|
|
91
|
-
case 15:
|
|
92
|
-
_context.prev = 15;
|
|
93
|
-
_context.t0 = _context["catch"](0);
|
|
94
|
-
return _context.abrupt("return", response({
|
|
95
|
-
message: "Error al obtener los datos",
|
|
96
|
-
errorDetail: _context.t0.message
|
|
97
|
-
}));
|
|
98
|
-
|
|
99
|
-
case 18:
|
|
100
|
-
case "end":
|
|
101
|
-
return _context.stop();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}, _callee, null, [[0, 15]]);
|
|
105
|
-
}));
|
|
106
|
-
|
|
107
|
-
return function (_x) {
|
|
108
|
-
return _ref.apply(this, arguments);
|
|
109
|
-
};
|
|
110
|
-
}());
|
|
111
|
-
}; //============================================================
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* funcion que realiza un axios POST
|
|
115
|
-
*
|
|
116
|
-
* Si <body> es undefined significa que hubo error
|
|
117
|
-
|
|
118
|
-
* @returns { Promise<{
|
|
119
|
-
* body: {} | undefined ,
|
|
120
|
-
* message: string,
|
|
121
|
-
* errorDetail: string
|
|
122
|
-
* }> }
|
|
123
|
-
*
|
|
124
|
-
*/
|
|
125
|
-
//============================================================
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
exports.fetchGET = fetchGET;
|
|
129
|
-
|
|
130
|
-
var fetchPOST = function fetchPOST() {
|
|
131
|
-
var endpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
132
|
-
var paramsBody = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
133
|
-
var paramsHeaders = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
134
|
-
return new Promise( /*#__PURE__*/function () {
|
|
135
|
-
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(response) {
|
|
136
|
-
var respHTTPjson, body, _body$message2, _body$errorDetail2;
|
|
137
|
-
|
|
138
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
139
|
-
while (1) {
|
|
140
|
-
switch (_context2.prev = _context2.next) {
|
|
141
|
-
case 0:
|
|
142
|
-
_context2.prev = 0;
|
|
143
|
-
_context2.next = 3;
|
|
144
|
-
return _axios.default.post(endpoint, paramsBody, {
|
|
145
|
-
headers: paramsHeaders
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
case 3:
|
|
149
|
-
respHTTPjson = _context2.sent;
|
|
150
|
-
|
|
151
|
-
if (!(respHTTPjson.status !== 200)) {
|
|
152
|
-
_context2.next = 6;
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return _context2.abrupt("return", response({
|
|
157
|
-
message: "No fue posible llevar a cabo la operación",
|
|
158
|
-
errorDetail: respHTTPjson.statusText
|
|
159
|
-
}));
|
|
160
|
-
|
|
161
|
-
case 6:
|
|
162
|
-
// obtener body backend
|
|
163
|
-
body = JSON.parse(respHTTPjson.data.body); // verificar si existe error desde el backend
|
|
164
|
-
|
|
165
|
-
if (!(respHTTPjson.data.statusCode !== 200)) {
|
|
166
|
-
_context2.next = 9;
|
|
167
|
-
break;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return _context2.abrupt("return", response({
|
|
171
|
-
message: (_body$message2 = body.message) !== null && _body$message2 !== void 0 ? _body$message2 : "",
|
|
172
|
-
errorDetail: (_body$errorDetail2 = body.errorDetail) !== null && _body$errorDetail2 !== void 0 ? _body$errorDetail2 : ""
|
|
173
|
-
}));
|
|
174
|
-
|
|
175
|
-
case 9:
|
|
176
|
-
return _context2.abrupt("return", response({
|
|
177
|
-
body: body
|
|
178
|
-
}));
|
|
179
|
-
|
|
180
|
-
case 12:
|
|
181
|
-
_context2.prev = 12;
|
|
182
|
-
_context2.t0 = _context2["catch"](0);
|
|
183
|
-
return _context2.abrupt("return", response({
|
|
184
|
-
message: "Error al guardar los datos",
|
|
185
|
-
errorDetail: _context2.t0.message
|
|
186
|
-
}));
|
|
187
|
-
|
|
188
|
-
case 15:
|
|
189
|
-
case "end":
|
|
190
|
-
return _context2.stop();
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}, _callee2, null, [[0, 12]]);
|
|
194
|
-
}));
|
|
195
|
-
|
|
196
|
-
return function (_x2) {
|
|
197
|
-
return _ref2.apply(this, arguments);
|
|
198
|
-
};
|
|
199
|
-
}());
|
|
200
|
-
}; //============================================================
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* funcion que realiza un axios GET
|
|
204
|
-
*
|
|
205
|
-
* Si <body> es undefined significa que hubo error
|
|
206
|
-
|
|
207
|
-
* @returns { Promise<{
|
|
208
|
-
* body: {} | undefined ,
|
|
209
|
-
* message: string,
|
|
210
|
-
* errorDetail: string
|
|
211
|
-
* }> }
|
|
212
|
-
*
|
|
213
|
-
*/
|
|
214
|
-
//============================================================
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
exports.fetchPOST = fetchPOST;
|
|
218
|
-
|
|
219
|
-
var fetchPUT = function fetchPUT() {
|
|
220
|
-
var endpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
221
|
-
var paramsBody = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
222
|
-
var paramsHeaders = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
223
|
-
return new Promise( /*#__PURE__*/function () {
|
|
224
|
-
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(response) {
|
|
225
|
-
var respHTTPjson, body, _body$message3, _body$errorDetail3;
|
|
226
|
-
|
|
227
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
228
|
-
while (1) {
|
|
229
|
-
switch (_context3.prev = _context3.next) {
|
|
230
|
-
case 0:
|
|
231
|
-
_context3.prev = 0;
|
|
232
|
-
_context3.next = 3;
|
|
233
|
-
return _axios.default.put(endpoint, paramsBody, {
|
|
234
|
-
headers: paramsHeaders
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
case 3:
|
|
238
|
-
respHTTPjson = _context3.sent;
|
|
239
|
-
|
|
240
|
-
if (!(respHTTPjson.status !== 200)) {
|
|
241
|
-
_context3.next = 6;
|
|
242
|
-
break;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
return _context3.abrupt("return", response({
|
|
246
|
-
message: "No fue posible llevar a cabo la operación",
|
|
247
|
-
errorDetail: respHTTPjson.statusText
|
|
248
|
-
}));
|
|
249
|
-
|
|
250
|
-
case 6:
|
|
251
|
-
// obtener body backend
|
|
252
|
-
body = JSON.parse(respHTTPjson.data.body); // verificar si existe error desde el backend
|
|
253
|
-
|
|
254
|
-
if (!(respHTTPjson.data.statusCode !== 200)) {
|
|
255
|
-
_context3.next = 9;
|
|
256
|
-
break;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return _context3.abrupt("return", response({
|
|
260
|
-
message: (_body$message3 = body.message) !== null && _body$message3 !== void 0 ? _body$message3 : "",
|
|
261
|
-
errorDetail: (_body$errorDetail3 = body.errorDetail) !== null && _body$errorDetail3 !== void 0 ? _body$errorDetail3 : ""
|
|
262
|
-
}));
|
|
263
|
-
|
|
264
|
-
case 9:
|
|
265
|
-
return _context3.abrupt("return", response({
|
|
266
|
-
body: body
|
|
267
|
-
}));
|
|
268
|
-
|
|
269
|
-
case 12:
|
|
270
|
-
_context3.prev = 12;
|
|
271
|
-
_context3.t0 = _context3["catch"](0);
|
|
272
|
-
return _context3.abrupt("return", response({
|
|
273
|
-
message: "Error al actualizar los datos",
|
|
274
|
-
errorDetail: _context3.t0.message
|
|
275
|
-
}));
|
|
276
|
-
|
|
277
|
-
case 15:
|
|
278
|
-
case "end":
|
|
279
|
-
return _context3.stop();
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}, _callee3, null, [[0, 12]]);
|
|
283
|
-
}));
|
|
284
|
-
|
|
285
|
-
return function (_x3) {
|
|
286
|
-
return _ref3.apply(this, arguments);
|
|
287
|
-
};
|
|
288
|
-
}());
|
|
289
|
-
}; //============================================================
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* funcion que realiza un axios GET
|
|
293
|
-
*
|
|
294
|
-
* Si <body> es undefined significa que hubo error
|
|
295
|
-
|
|
296
|
-
* @returns { Promise<{
|
|
297
|
-
* body: {} | undefined ,
|
|
298
|
-
* message: string,
|
|
299
|
-
* errorDetail: string
|
|
300
|
-
* }> }
|
|
301
|
-
*
|
|
302
|
-
*/
|
|
303
|
-
//============================================================
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
exports.fetchPUT = fetchPUT;
|
|
307
|
-
|
|
308
|
-
var fetchDELETE = function fetchDELETE() {
|
|
309
|
-
var endpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
310
|
-
var paramsBody = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
311
|
-
var paramsHeaders = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
312
|
-
return new Promise( /*#__PURE__*/function () {
|
|
313
|
-
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(response) {
|
|
314
|
-
var respHTTPjson, body, _body$message4, _body$errorDetail4;
|
|
315
|
-
|
|
316
|
-
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
317
|
-
while (1) {
|
|
318
|
-
switch (_context4.prev = _context4.next) {
|
|
319
|
-
case 0:
|
|
320
|
-
_context4.prev = 0;
|
|
321
|
-
_context4.next = 3;
|
|
322
|
-
return _axios.default.delete(endpoint, {
|
|
323
|
-
data: paramsBody,
|
|
324
|
-
headers: paramsHeaders
|
|
325
|
-
});
|
|
326
|
-
|
|
327
|
-
case 3:
|
|
328
|
-
respHTTPjson = _context4.sent;
|
|
329
|
-
|
|
330
|
-
if (!(respHTTPjson.status !== 200)) {
|
|
331
|
-
_context4.next = 6;
|
|
332
|
-
break;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
return _context4.abrupt("return", response({
|
|
336
|
-
message: "No fue posible llevar a cabo la operación",
|
|
337
|
-
errorDetail: respHTTPjson.statusText
|
|
338
|
-
}));
|
|
339
|
-
|
|
340
|
-
case 6:
|
|
341
|
-
// obtener body backend
|
|
342
|
-
body = JSON.parse(respHTTPjson.data.body); // verificar si existe error desde el backend
|
|
343
|
-
|
|
344
|
-
if (!(respHTTPjson.data.statusCode !== 200)) {
|
|
345
|
-
_context4.next = 9;
|
|
346
|
-
break;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
return _context4.abrupt("return", response({
|
|
350
|
-
message: (_body$message4 = body.message) !== null && _body$message4 !== void 0 ? _body$message4 : "",
|
|
351
|
-
errorDetail: (_body$errorDetail4 = body.errorDetail) !== null && _body$errorDetail4 !== void 0 ? _body$errorDetail4 : ""
|
|
352
|
-
}));
|
|
353
|
-
|
|
354
|
-
case 9:
|
|
355
|
-
return _context4.abrupt("return", response({
|
|
356
|
-
body: body
|
|
357
|
-
}));
|
|
358
|
-
|
|
359
|
-
case 12:
|
|
360
|
-
_context4.prev = 12;
|
|
361
|
-
_context4.t0 = _context4["catch"](0);
|
|
362
|
-
return _context4.abrupt("return", response({
|
|
363
|
-
message: "Error al actualizar los datos",
|
|
364
|
-
errorDetail: _context4.t0.message
|
|
365
|
-
}));
|
|
366
|
-
|
|
367
|
-
case 15:
|
|
368
|
-
case "end":
|
|
369
|
-
return _context4.stop();
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}, _callee4, null, [[0, 12]]);
|
|
373
|
-
}));
|
|
374
|
-
|
|
375
|
-
return function (_x4) {
|
|
376
|
-
return _ref4.apply(this, arguments);
|
|
377
|
-
};
|
|
378
|
-
}());
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
exports.fetchDELETE = fetchDELETE;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isUserTech = exports.isUserAdminTech = void 0;
|
|
7
|
-
|
|
8
|
-
var isUserTech = function isUserTech() {
|
|
9
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
10
|
-
return ["AS", "ADMIN-AS", "ADMIN"].includes(value);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
exports.isUserTech = isUserTech;
|
|
14
|
-
|
|
15
|
-
var isUserAdminTech = function isUserAdminTech() {
|
|
16
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
17
|
-
return ["ADMIN-AS", "ADMIN"].includes(value);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
exports.isUserAdminTech = isUserAdminTech;
|