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