@ssplib/react-components 0.0.121 → 0.0.123

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.
@@ -77,8 +77,7 @@ function FileUpload({ name, tipoArquivo, title, required = false, multiple = fal
77
77
  method: 'POST',
78
78
  body: fd,
79
79
  headers: {
80
- // Authorization: `Bearer ${user ? user.token : ''}`,
81
- Authorization: `Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NywibmFtZSI6IlBlZGluIiwiZW1haWwiOiJnYWl0YWNoaTBAZ21haWwuY29tIiwicGhvbmVfbnVtYmVyIjoiNjE5OTMwNTg0MjMiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiIwNTUxOTQyOTE2MiIsInJvbGVzIjpbeyJjb2RlIjoxLCJuYW1lIjoiVXNlciBFdmVudG9zIiwic3lzdGVtIjoyfSx7ImNvZGUiOjIsIm5hbWUiOiJBZG1pbiBFdmVudG9zIiwic3lzdGVtIjoyfSx7ImNvZGUiOjQsIm5hbWUiOiJDb25zZWcgVmFsaWRhZG9yIiwic3lzdGVtIjozfSx7ImNvZGUiOjYsIm5hbWUiOiJVc2VyIENvbnNlZyIsInN5c3RlbSI6M31dLCJpYXQiOjE2OTE2MDEyODksImV4cCI6MTY5MjIwNjA4OSwiYXVkIjoiVXNlcnMiLCJpc3MiOiJBdXRoU1NQIiwic3ViIjoiMDU1MTk0MjkxNjIifQ.SNU02JpcWQejBnrG6OMGVof4ALAgSEIAc3qAUnKDHSY`,
80
+ Authorization: `Bearer ${user ? user.token : ''}`,
82
81
  },
83
82
  })
84
83
  .then((res) => {
@@ -114,9 +113,10 @@ function FileUpload({ name, tipoArquivo, title, required = false, multiple = fal
114
113
  }),
115
114
  ]);
116
115
  }, [files, context]);
117
- const removeFile = (id, hideMsg) => {
116
+ const removeFile = (id, hideMsg, fileId) => {
118
117
  setFiles(files.filter((x) => x.id !== id));
119
- context.setFilesUid((fId) => fId.filter((idd) => idd.CO_SEQ_ARQUIVO !== id));
118
+ if (fileId)
119
+ context.setFilesUid((fId) => fId.filter((idd) => idd.CO_SEQ_ARQUIVO !== fileId));
120
120
  if (!hideMsg) {
121
121
  setErrorMsg('Erro ao enviar arquivo. Tente novamente mais tarde');
122
122
  setTimeout(() => {
@@ -134,10 +134,9 @@ function FileUpload({ name, tipoArquivo, title, required = false, multiple = fal
134
134
  })
135
135
  .then((res) => {
136
136
  if (!res.ok)
137
- removeFile(id, true);
137
+ removeFile(id, true, fileIds[id]);
138
138
  if (res.status === 200) {
139
- setFiles(files.filter((x) => x.id !== id));
140
- context.setFilesUid((fId) => fId.filter((idd) => idd.CO_SEQ_ARQUIVO !== id));
139
+ removeFile(id, true, fileIds[id]);
141
140
  }
142
141
  })
143
142
  .catch((err) => console.log(err));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssplib/react-components",
3
- "version": "0.0.121",
3
+ "version": "0.0.123",
4
4
  "description": "SSP React Components",
5
5
  "main": "index.js",
6
6
  "author": "Pedro Henrique <sr.hudrick@gmail.com>",