polgo-upload-kit 1.1.6 → 1.1.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polgo-upload-kit",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "type": "module",
5
5
  "main": "src/polgoUploadClient.js",
6
6
  "scripts": {
@@ -1,4 +1,3 @@
1
- // src/index.js
2
1
  import axios from "axios";
3
2
 
4
3
  class PolgoUploadClient {
@@ -10,7 +9,7 @@ class PolgoUploadClient {
10
9
  this.token = token;
11
10
  }
12
11
 
13
- async uploadFile(bufferArquivo, bucket, options = {}, onProgress) {
12
+ async uploadFile(bufferArquivo, bucket, options = {}) {
14
13
  const mimeType = bufferArquivo.type;
15
14
 
16
15
  const fileBlob = new Blob([bufferArquivo], { type: mimeType });
@@ -31,19 +30,15 @@ class PolgoUploadClient {
31
30
 
32
31
  try {
33
32
  const response = await axios.post(finalUrl, form, {
34
- onUploadProgress: (progressEvent) => {
35
- const progress = Math.round(
36
- (progressEvent.loaded * 100) / progressEvent.total
37
- );
38
- this.uploadProgress = progress;
39
- console.log(`Progresso do upload: ${progress}%`);
33
+ headers: {
34
+ Authorization: `Bearer ${this.token}`,
40
35
  },
41
36
  });
42
37
  return response.data;
43
38
  } catch (error) {
44
39
  console.error("Erro ao fazer upload do arquivo:", error.message);
45
40
  throw new Error(
46
- `Falha ao realizar o upload do arquivo: ${error.message}`
41
+ 'Falha ao realizar o upload do arquivo: ${error.message}'
47
42
  );
48
43
  }
49
44
  }