lupine.components 1.0.6 → 1.0.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/package.json +1 -1
- package/src/lib/upload-file.ts +14 -9
package/package.json
CHANGED
package/src/lib/upload-file.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getRenderPageProps } from "lupine.web";
|
|
2
|
+
|
|
1
3
|
const _saveChunkSize = {
|
|
2
4
|
size: 1024 * 500,
|
|
3
5
|
};
|
|
@@ -8,10 +10,11 @@ export const getChunkSize = () => {
|
|
|
8
10
|
return _saveChunkSize.size;
|
|
9
11
|
};
|
|
10
12
|
export const checkUploadedFileSize = async (uploadUrl: string) => {
|
|
11
|
-
const response = await fetch(uploadUrl + '?check-size=1', {
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
const json = await response.json();
|
|
13
|
+
// const response = await fetch(uploadUrl + '?check-size=1', {
|
|
14
|
+
// method: 'POST',
|
|
15
|
+
// });
|
|
16
|
+
// const json = await response.json();
|
|
17
|
+
const json = await getRenderPageProps().renderPageFunctions.fetchData(uploadUrl + '?check-size=1');
|
|
15
18
|
return json && json.size ? json.size : 0;
|
|
16
19
|
};
|
|
17
20
|
|
|
@@ -30,11 +33,13 @@ export const uploadFileChunk = async (
|
|
|
30
33
|
if (key) {
|
|
31
34
|
url += `&key=${key}`;
|
|
32
35
|
}
|
|
33
|
-
const response = await fetch(url, {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
const json = await response.json();
|
|
36
|
+
// const response = await fetch(url, {
|
|
37
|
+
// method: 'POST',
|
|
38
|
+
// body: chunk,
|
|
39
|
+
// });
|
|
40
|
+
// const json = await response.json();
|
|
41
|
+
console.log(`uploadFileChunk, ${uploadUrl}, index: ${chunkNumber}, total: ${totalChunks}, len: ${chunk.length}`);
|
|
42
|
+
const json = await getRenderPageProps().renderPageFunctions.fetchData(url, chunk);
|
|
38
43
|
return json;
|
|
39
44
|
};
|
|
40
45
|
|