sirius-common-utils 1.0.19 → 1.0.21
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.
|
@@ -148,12 +148,13 @@ const AppUtils = {
|
|
|
148
148
|
setSessionStorageObjItem,
|
|
149
149
|
getSessionStorageObjItem
|
|
150
150
|
};
|
|
151
|
-
async function init$2(deviceType, pCurrUserInfoCache, pCustomizedUserUtils) {
|
|
151
|
+
async function init$2(deviceType, pCurrUserInfoCache, pCustomizedUserUtils, pUriGetCurrUserInfo) {
|
|
152
152
|
if (pCurrUserInfoCache) {
|
|
153
153
|
currUserInfoCache = pCurrUserInfoCache;
|
|
154
154
|
AppUtils.setLocalStorageObjItem("CURRENT_USER", currUserInfoCache);
|
|
155
155
|
}
|
|
156
156
|
customizedUserUtils = pCustomizedUserUtils;
|
|
157
|
+
uriGetCurrUserInfo = pUriGetCurrUserInfo || `/api/user/getCurrUserInfo`;
|
|
157
158
|
await getCurrUserModel();
|
|
158
159
|
setDeviceType(deviceType);
|
|
159
160
|
}
|
|
@@ -198,11 +199,11 @@ function getCurrUserId() {
|
|
|
198
199
|
var _a;
|
|
199
200
|
return (_a = getCurrUserInfoCache()) == null ? void 0 : _a.id;
|
|
200
201
|
}
|
|
202
|
+
let uriGetCurrUserInfo = null;
|
|
201
203
|
let appUserModel = null;
|
|
202
204
|
async function getCurrUserModel() {
|
|
203
205
|
if (appUserModel == null) {
|
|
204
|
-
|
|
205
|
-
appUserModel = await AxiosUtils.getJsonData(url);
|
|
206
|
+
appUserModel = await AxiosUtils.getJsonData(uriGetCurrUserInfo);
|
|
206
207
|
}
|
|
207
208
|
return appUserModel;
|
|
208
209
|
}
|
|
@@ -387,6 +388,17 @@ function downloadServerData(url) {
|
|
|
387
388
|
resolve(true);
|
|
388
389
|
});
|
|
389
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
|
+
}
|
|
390
402
|
function uploadFile(url, file, headers, onUploadProgress, customizedOptions) {
|
|
391
403
|
headers = headers || {};
|
|
392
404
|
let formdata = new FormData();
|
|
@@ -575,6 +587,7 @@ const AxiosUtils = {
|
|
|
575
587
|
downloadExcelData,
|
|
576
588
|
downloadImageData,
|
|
577
589
|
downloadServerData,
|
|
590
|
+
downloadServerBlobData,
|
|
578
591
|
uploadFile,
|
|
579
592
|
getStaticTextFile,
|
|
580
593
|
appSessionExit,
|
|
@@ -149,12 +149,13 @@
|
|
|
149
149
|
setSessionStorageObjItem,
|
|
150
150
|
getSessionStorageObjItem
|
|
151
151
|
};
|
|
152
|
-
async function init$2(deviceType, pCurrUserInfoCache, pCustomizedUserUtils) {
|
|
152
|
+
async function init$2(deviceType, pCurrUserInfoCache, pCustomizedUserUtils, pUriGetCurrUserInfo) {
|
|
153
153
|
if (pCurrUserInfoCache) {
|
|
154
154
|
currUserInfoCache = pCurrUserInfoCache;
|
|
155
155
|
AppUtils.setLocalStorageObjItem("CURRENT_USER", currUserInfoCache);
|
|
156
156
|
}
|
|
157
157
|
customizedUserUtils = pCustomizedUserUtils;
|
|
158
|
+
uriGetCurrUserInfo = pUriGetCurrUserInfo || `/api/user/getCurrUserInfo`;
|
|
158
159
|
await getCurrUserModel();
|
|
159
160
|
setDeviceType(deviceType);
|
|
160
161
|
}
|
|
@@ -199,11 +200,11 @@
|
|
|
199
200
|
var _a;
|
|
200
201
|
return (_a = getCurrUserInfoCache()) == null ? void 0 : _a.id;
|
|
201
202
|
}
|
|
203
|
+
let uriGetCurrUserInfo = null;
|
|
202
204
|
let appUserModel = null;
|
|
203
205
|
async function getCurrUserModel() {
|
|
204
206
|
if (appUserModel == null) {
|
|
205
|
-
|
|
206
|
-
appUserModel = await AxiosUtils.getJsonData(url);
|
|
207
|
+
appUserModel = await AxiosUtils.getJsonData(uriGetCurrUserInfo);
|
|
207
208
|
}
|
|
208
209
|
return appUserModel;
|
|
209
210
|
}
|
|
@@ -388,6 +389,17 @@
|
|
|
388
389
|
resolve(true);
|
|
389
390
|
});
|
|
390
391
|
}
|
|
392
|
+
function downloadServerBlobData(url) {
|
|
393
|
+
return new Promise(function(resolve, reject) {
|
|
394
|
+
axios.get(url, {
|
|
395
|
+
responseType: "blob"
|
|
396
|
+
}).then((res) => {
|
|
397
|
+
resolve(res.data);
|
|
398
|
+
}, (error) => {
|
|
399
|
+
resolve(null);
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
}
|
|
391
403
|
function uploadFile(url, file, headers, onUploadProgress, customizedOptions) {
|
|
392
404
|
headers = headers || {};
|
|
393
405
|
let formdata = new FormData();
|
|
@@ -576,6 +588,7 @@
|
|
|
576
588
|
downloadExcelData,
|
|
577
589
|
downloadImageData,
|
|
578
590
|
downloadServerData,
|
|
591
|
+
downloadServerBlobData,
|
|
579
592
|
uploadFile,
|
|
580
593
|
getStaticTextFile,
|
|
581
594
|
appSessionExit,
|