chore: removing onUploadProgress from upload plugin

This commit is contained in:
Bassel Kanso 2024-05-02 13:32:54 +03:00
parent d696828dfe
commit 833d0a7ccd
4 changed files with 10 additions and 14 deletions

View File

@ -26,14 +26,13 @@ const editAssetRequest = (asset, file, signal, onProgress, post) => {
})
);
/**
* onProgress is not possible using native fetch
* need to look into an alternative to make it work
* perhaps using xhr like Axios does
*/
return post(endpoint, formData, {
signal,
onUploadProgress({ total, loaded }) {
onProgress((loaded / total) * 100);
},
headers: {
'Content-Type': 'multipart/form-data',
},
}).then((res) => res.data);
};

View File

@ -23,14 +23,13 @@ const uploadAsset = (asset, folderId, signal, onProgress, post) => {
})
);
/**
* onProgress is not possible using native fetch
* need to look into an alternative to make it work
* perhaps using xhr like Axios does
*/
return post(endpoint, formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
signal,
onUploadProgress({ total, loaded }) {
onProgress((loaded / total) * 100);
},
}).then((res) => res.data);
};

View File

@ -52,7 +52,6 @@
"@strapi/icons": "2.0.0-beta.2",
"@strapi/provider-upload-local": "5.0.0-beta.5",
"@strapi/utils": "5.0.0-beta.5",
"axios": "1.6.8",
"byte-size": "8.1.1",
"cropperjs": "1.6.1",
"date-fns": "2.30.0",

View File

@ -7922,7 +7922,6 @@ __metadata:
"@types/koa": "npm:2.13.4"
"@types/koa-range": "npm:0.3.5"
"@types/koa-static": "npm:4.0.2"
axios: "npm:1.6.8"
byte-size: "npm:8.1.1"
cropperjs: "npm:1.6.1"
date-fns: "npm:2.30.0"