code7-leia 0.2.11 → 0.2.16

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.
@@ -1534,7 +1534,6 @@ var FileArea = function FileArea() {
1534
1534
  setModal(!modal);
1535
1535
  };
1536
1536
  var handleOpenModalDelete = function handleOpenModalDelete(name) {
1537
- console.log('--- handleOpenModalDelete: ', name);
1538
1537
  setFileDelete(name);
1539
1538
  setModalDelete(!modalDelete);
1540
1539
  };
@@ -1549,7 +1548,6 @@ var FileArea = function FileArea() {
1549
1548
  setModalTraining(!modalTraining);
1550
1549
  };
1551
1550
  var deleteFile = function deleteFile() {
1552
- console.log('--- vai deletar: ', fileDelete);
1553
1551
  dispatch(deleteFilesAction(fileDelete, id, language, token));
1554
1552
  setModalDelete(false);
1555
1553
  };
@@ -2185,7 +2183,7 @@ function testSaga(action) {
2185
2183
  }, _marked3, null, [[0, 12, 15, 19]]);
2186
2184
  }
2187
2185
  function uploadFilesSaga(action) {
2188
- var t, _action$payload4, id, file, pressets, token, blob, formData, queryParams, url, _yield$call4, data;
2186
+ var t, _action$payload4, id, file, pressets, token, blob, formData, sanitizedPath, queryParams, url, _yield$call4, data;
2189
2187
  return _regeneratorRuntime().wrap(function uploadFilesSaga$(_context4) {
2190
2188
  while (1) switch (_context4.prev = _context4.next) {
2191
2189
  case 0:
@@ -2197,49 +2195,50 @@ function uploadFilesSaga(action) {
2197
2195
  _action$payload4 = action.payload, id = _action$payload4.id, file = _action$payload4.file, pressets = _action$payload4.pressets, token = _action$payload4.token;
2198
2196
  blob = new Blob([file.content]);
2199
2197
  formData = new FormData();
2200
- formData.append('file', blob, file.properties.path);
2198
+ sanitizedPath = file.properties.path.replace(/^\/+|\/+$/g, '');
2199
+ formData.append('file', blob, sanitizedPath || 'default_filename');
2201
2200
  queryParams = pressets.length ? new URLSearchParams({
2202
2201
  tags: pressets.join(',')
2203
2202
  }).toString() : '';
2204
2203
  url = queryParams ? "/upload/" + id + "?token=" + token + "&" + queryParams : "/upload/" + id + "?token=" + token;
2205
- _context4.next = 12;
2204
+ _context4.next = 13;
2206
2205
  return call(api.post, url, formData, {
2207
2206
  headers: {
2208
2207
  'Content-Type': 'multipart/form-data'
2209
2208
  }
2210
2209
  });
2211
- case 12:
2212
- _context4.next = 14;
2210
+ case 13:
2211
+ _context4.next = 15;
2213
2212
  return call(api.get, "/training/" + id + "?token=" + token);
2214
- case 14:
2213
+ case 15:
2215
2214
  _yield$call4 = _context4.sent;
2216
2215
  data = _yield$call4.data;
2217
- _context4.next = 18;
2216
+ _context4.next = 19;
2218
2217
  return put(uploadFilesActionSuccess({
2219
2218
  files: data.files
2220
2219
  }));
2221
- case 18:
2222
- _context4.next = 24;
2220
+ case 19:
2221
+ _context4.next = 25;
2223
2222
  break;
2224
- case 20:
2225
- _context4.prev = 20;
2223
+ case 21:
2224
+ _context4.prev = 21;
2226
2225
  _context4.t0 = _context4["catch"](1);
2227
2226
  toast.error({
2228
2227
  title: t.toast.uploadFile.fail.title,
2229
2228
  description: t.toast.uploadFile.fail.description
2230
2229
  });
2231
2230
  console.log('-----------uploadFilesSaga.error------------------->', _context4.t0);
2232
- case 24:
2233
- _context4.prev = 24;
2234
- _context4.next = 27;
2231
+ case 25:
2232
+ _context4.prev = 25;
2233
+ _context4.next = 28;
2235
2234
  return put(commonLoadingFinish());
2236
- case 27:
2237
- return _context4.finish(24);
2238
2235
  case 28:
2236
+ return _context4.finish(25);
2237
+ case 29:
2239
2238
  case "end":
2240
2239
  return _context4.stop();
2241
2240
  }
2242
- }, _marked4, null, [[1, 20, 24, 28]]);
2241
+ }, _marked4, null, [[1, 21, 25, 29]]);
2243
2242
  }
2244
2243
  function TrainingSaga(action) {
2245
2244
  var t, _action$payload5, id, pressets, token, tag, queryParams, _yield$call5, data;