@steroidsjs/core 2.2.50 → 2.2.51
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/hooks/useFile.js +20 -9
- package/package.json +1 -1
package/hooks/useFile.js
CHANGED
|
@@ -56,19 +56,30 @@ function useFile(props) {
|
|
|
56
56
|
if (initialFiles) {
|
|
57
57
|
uploader.queue.add([].concat(initialFiles || [])
|
|
58
58
|
.filter(function (item) { return !!item.uid; })
|
|
59
|
-
.map(function (item) {
|
|
60
|
-
path
|
|
61
|
-
|
|
62
|
-
result: File_1["default"].RESULT_SUCCESS,
|
|
63
|
-
resultHttpStatus: 200,
|
|
64
|
-
resultHttpMessage: {
|
|
59
|
+
.map(function (item) {
|
|
60
|
+
var path = item.title || item.label || item.uid || item.id;
|
|
61
|
+
var resultHttpMessage = {
|
|
65
62
|
id: item.id || item.uid,
|
|
66
63
|
images: item.thumbnailUrl
|
|
67
64
|
? [{ url: item.thumbnailUrl }]
|
|
68
65
|
: null
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
};
|
|
67
|
+
var file = uploader.queue.getByUid(item.uid);
|
|
68
|
+
if (file) {
|
|
69
|
+
file.setPath(path);
|
|
70
|
+
file.setResultHttpMessage(resultHttpMessage);
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return new File_1["default"]({
|
|
74
|
+
path: path,
|
|
75
|
+
status: File_1["default"].STATUS_END,
|
|
76
|
+
result: File_1["default"].RESULT_SUCCESS,
|
|
77
|
+
resultHttpStatus: 200,
|
|
78
|
+
resultHttpMessage: resultHttpMessage,
|
|
79
|
+
uid: item.uid
|
|
80
|
+
});
|
|
81
|
+
})
|
|
82
|
+
.filter(Boolean));
|
|
72
83
|
forceUpdate();
|
|
73
84
|
}
|
|
74
85
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|