authscape 1.0.232 → 1.0.233
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/index.js +22 -13
- package/package.json +1 -1
- package/src/services/apiService.js +12 -4
package/index.js
CHANGED
|
@@ -2770,40 +2770,49 @@ var apiService = function apiService() {
|
|
|
2770
2770
|
}(),
|
|
2771
2771
|
DownloadFile: function () {
|
|
2772
2772
|
var _DownloadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(url, fileName, completed) {
|
|
2773
|
-
var
|
|
2773
|
+
var passData,
|
|
2774
|
+
defaultOptions,
|
|
2775
|
+
options,
|
|
2776
|
+
response,
|
|
2777
|
+
_args9 = arguments;
|
|
2774
2778
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
2775
2779
|
while (1) switch (_context9.prev = _context9.next) {
|
|
2776
2780
|
case 0:
|
|
2777
|
-
|
|
2781
|
+
passData = _args9.length > 3 && _args9[3] !== undefined ? _args9[3] : false;
|
|
2782
|
+
_context9.prev = 1;
|
|
2778
2783
|
//let defaultOptions = await setupDefaultOptions();
|
|
2779
2784
|
defaultOptions = {};
|
|
2780
2785
|
options = {
|
|
2781
2786
|
responseType: "blob"
|
|
2782
2787
|
};
|
|
2783
|
-
_context9.next =
|
|
2788
|
+
_context9.next = 6;
|
|
2784
2789
|
return instance.get(url, _objectSpread(_objectSpread({}, defaultOptions), options));
|
|
2785
|
-
case
|
|
2790
|
+
case 6:
|
|
2786
2791
|
response = _context9.sent;
|
|
2787
2792
|
if (response.status === 200) {
|
|
2788
|
-
(
|
|
2789
|
-
|
|
2790
|
-
completed
|
|
2793
|
+
if (!passData) {
|
|
2794
|
+
(0, _jsFileDownload["default"])(response.data, fileName);
|
|
2795
|
+
if (completed !== undefined) {
|
|
2796
|
+
completed();
|
|
2797
|
+
}
|
|
2798
|
+
} else {
|
|
2799
|
+
completed(response.data);
|
|
2791
2800
|
}
|
|
2792
2801
|
}
|
|
2793
|
-
_context9.next =
|
|
2802
|
+
_context9.next = 14;
|
|
2794
2803
|
break;
|
|
2795
|
-
case
|
|
2796
|
-
_context9.prev =
|
|
2797
|
-
_context9.t0 = _context9["catch"](
|
|
2804
|
+
case 10:
|
|
2805
|
+
_context9.prev = 10;
|
|
2806
|
+
_context9.t0 = _context9["catch"](1);
|
|
2798
2807
|
console.error(_context9.t0);
|
|
2799
2808
|
if (completed !== undefined) {
|
|
2800
2809
|
completed();
|
|
2801
2810
|
}
|
|
2802
|
-
case
|
|
2811
|
+
case 14:
|
|
2803
2812
|
case "end":
|
|
2804
2813
|
return _context9.stop();
|
|
2805
2814
|
}
|
|
2806
|
-
}, _callee9, null, [[
|
|
2815
|
+
}, _callee9, null, [[1, 10]]);
|
|
2807
2816
|
}));
|
|
2808
2817
|
function DownloadFile(_x10, _x11, _x12) {
|
|
2809
2818
|
return _DownloadFile.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -229,7 +229,7 @@ export const apiService = (ctx = null) => {
|
|
|
229
229
|
}
|
|
230
230
|
return null;
|
|
231
231
|
},
|
|
232
|
-
DownloadFile: async (url, fileName, completed) => {
|
|
232
|
+
DownloadFile: async (url, fileName, completed, passData = false) => {
|
|
233
233
|
|
|
234
234
|
try
|
|
235
235
|
{
|
|
@@ -238,9 +238,17 @@ export const apiService = (ctx = null) => {
|
|
|
238
238
|
let options = { responseType: "blob" };
|
|
239
239
|
let response = await instance.get(url, { ...defaultOptions, ...options });
|
|
240
240
|
if (response.status === 200) {
|
|
241
|
-
|
|
242
|
-
if (
|
|
243
|
-
|
|
241
|
+
|
|
242
|
+
if (!passData)
|
|
243
|
+
{
|
|
244
|
+
fileDownload(response.data, fileName);
|
|
245
|
+
if (completed !== undefined) {
|
|
246
|
+
completed();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
else
|
|
250
|
+
{
|
|
251
|
+
completed(response.data);
|
|
244
252
|
}
|
|
245
253
|
}
|
|
246
254
|
}
|