polgo-upload-kit 1.1.2 → 1.1.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polgo-upload-kit",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "type": "module",
5
5
  "main": "src/polgoUploadClient.js",
6
6
  "scripts": {
@@ -30,17 +30,13 @@ class PolgoUploadClient {
30
30
  form.append("bucket", bucket);
31
31
 
32
32
  try {
33
- const response = await axios.post(finalUrl, form, {
34
- headers: {
35
- Authorization: `Bearer ${this.token}`,
36
- },
33
+ const response = await axios.post("URL_DO_ENDPOINT", formData, {
37
34
  onUploadProgress: (progressEvent) => {
38
- const percentCompleted = Math.round(
39
- (progressEvent.loaded / progressEvent.total) * 100
35
+ const progress = Math.round(
36
+ (progressEvent.loaded * 100) / progressEvent.total
40
37
  );
41
- if (onProgress) {
42
- onProgress(percentCompleted);
43
- }
38
+ this.uploadProgress = progress;
39
+ console.log(`Progresso do upload: ${progress}%`);
44
40
  },
45
41
  });
46
42
  return response.data;