@inertiajs/core 3.0.1 → 3.0.2
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/dist/index.js +4 -2
- package/dist/index.js.map +3 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1923,8 +1923,10 @@ var XhrHttpClient = class {
|
|
|
1923
1923
|
setHeaders(xhr, config2);
|
|
1924
1924
|
if (config2.onUploadProgress) {
|
|
1925
1925
|
xhr.upload.onprogress = (event) => {
|
|
1926
|
+
const progress3 = event.lengthComputable ? event.loaded / event.total : void 0;
|
|
1926
1927
|
config2.onUploadProgress({
|
|
1927
|
-
progress:
|
|
1928
|
+
progress: progress3,
|
|
1929
|
+
percentage: progress3 ? Math.round(progress3 * 100) : 0,
|
|
1928
1930
|
loaded: event.loaded,
|
|
1929
1931
|
total: event.lengthComputable ? event.total : void 0
|
|
1930
1932
|
});
|
|
@@ -2722,7 +2724,6 @@ var Request = class _Request {
|
|
|
2722
2724
|
}
|
|
2723
2725
|
onProgress(progress3) {
|
|
2724
2726
|
if (this.requestParams.data() instanceof FormData) {
|
|
2725
|
-
progress3.percentage = progress3.progress ? Math.round(progress3.progress * 100) : 0;
|
|
2726
2727
|
fireProgressEvent(progress3);
|
|
2727
2728
|
this.requestParams.all().onProgress(progress3);
|
|
2728
2729
|
}
|
|
@@ -3429,6 +3430,7 @@ function normalizeHeaders(headers) {
|
|
|
3429
3430
|
function toHttpProgressEvent(axiosEvent) {
|
|
3430
3431
|
return {
|
|
3431
3432
|
progress: axiosEvent.progress,
|
|
3433
|
+
percentage: axiosEvent.progress ? Math.round(axiosEvent.progress * 100) : 0,
|
|
3432
3434
|
loaded: axiosEvent.loaded,
|
|
3433
3435
|
total: axiosEvent.total
|
|
3434
3436
|
};
|