sirius-common-utils 1.0.18 → 1.0.20

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.
@@ -359,8 +359,8 @@ function downloadImageData(url, data, headers, options = {}) {
359
359
  headers,
360
360
  responseType: "blob"
361
361
  });
362
- let imageData = response.blob();
363
- if (imageData == null) {
362
+ let imageData = response.data;
363
+ if (imageData != null) {
364
364
  if (response.data.errorCode && response.data.errorCode !== RESULT.SUCCESS) {
365
365
  let errorResult = await handlerError(url, data, response);
366
366
  resolve(null);
@@ -387,6 +387,17 @@ function downloadServerData(url) {
387
387
  resolve(true);
388
388
  });
389
389
  }
390
+ function downloadServerBlobData(url) {
391
+ return new Promise(function(resolve, reject) {
392
+ axios.get(url, {
393
+ responseType: "blob"
394
+ }).then((res) => {
395
+ resolve(res.data);
396
+ }, (error) => {
397
+ resolve(null);
398
+ });
399
+ });
400
+ }
390
401
  function uploadFile(url, file, headers, onUploadProgress, customizedOptions) {
391
402
  headers = headers || {};
392
403
  let formdata = new FormData();
@@ -575,6 +586,7 @@ const AxiosUtils = {
575
586
  downloadExcelData,
576
587
  downloadImageData,
577
588
  downloadServerData,
589
+ downloadServerBlobData,
578
590
  uploadFile,
579
591
  getStaticTextFile,
580
592
  appSessionExit,
@@ -360,8 +360,8 @@
360
360
  headers,
361
361
  responseType: "blob"
362
362
  });
363
- let imageData = response.blob();
364
- if (imageData == null) {
363
+ let imageData = response.data;
364
+ if (imageData != null) {
365
365
  if (response.data.errorCode && response.data.errorCode !== RESULT.SUCCESS) {
366
366
  let errorResult = await handlerError(url, data, response);
367
367
  resolve(null);
@@ -388,6 +388,17 @@
388
388
  resolve(true);
389
389
  });
390
390
  }
391
+ function downloadServerBlobData(url) {
392
+ return new Promise(function(resolve, reject) {
393
+ axios.get(url, {
394
+ responseType: "blob"
395
+ }).then((res) => {
396
+ resolve(res.data);
397
+ }, (error) => {
398
+ resolve(null);
399
+ });
400
+ });
401
+ }
391
402
  function uploadFile(url, file, headers, onUploadProgress, customizedOptions) {
392
403
  headers = headers || {};
393
404
  let formdata = new FormData();
@@ -576,6 +587,7 @@
576
587
  downloadExcelData,
577
588
  downloadImageData,
578
589
  downloadServerData,
590
+ downloadServerBlobData,
579
591
  uploadFile,
580
592
  getStaticTextFile,
581
593
  appSessionExit,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sirius-common-utils",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "",
5
5
  "main": "./dist/sirius-common-utils.umd.cjs",
6
6
  "module": "./dist/sirius-common-utils.js",