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.
@@ -1542,7 +1542,6 @@ var FileArea = function FileArea() {
1542
1542
  setModal(!modal);
1543
1543
  };
1544
1544
  var handleOpenModalDelete = function handleOpenModalDelete(name) {
1545
- console.log('--- handleOpenModalDelete: ', name);
1546
1545
  setFileDelete(name);
1547
1546
  setModalDelete(!modalDelete);
1548
1547
  };
@@ -1557,7 +1556,6 @@ var FileArea = function FileArea() {
1557
1556
  setModalTraining(!modalTraining);
1558
1557
  };
1559
1558
  var deleteFile = function deleteFile() {
1560
- console.log('--- vai deletar: ', fileDelete);
1561
1559
  dispatch(deleteFilesAction(fileDelete, id, language, token));
1562
1560
  setModalDelete(false);
1563
1561
  };
@@ -2193,7 +2191,7 @@ function testSaga(action) {
2193
2191
  }, _marked3, null, [[0, 12, 15, 19]]);
2194
2192
  }
2195
2193
  function uploadFilesSaga(action) {
2196
- var t, _action$payload4, id, file, pressets, token, blob, formData, queryParams, url, _yield$call4, data;
2194
+ var t, _action$payload4, id, file, pressets, token, blob, formData, sanitizedPath, queryParams, url, _yield$call4, data;
2197
2195
  return _regeneratorRuntime().wrap(function uploadFilesSaga$(_context4) {
2198
2196
  while (1) switch (_context4.prev = _context4.next) {
2199
2197
  case 0:
@@ -2205,49 +2203,50 @@ function uploadFilesSaga(action) {
2205
2203
  _action$payload4 = action.payload, id = _action$payload4.id, file = _action$payload4.file, pressets = _action$payload4.pressets, token = _action$payload4.token;
2206
2204
  blob = new Blob([file.content]);
2207
2205
  formData = new FormData();
2208
- formData.append('file', blob, file.properties.path);
2206
+ sanitizedPath = file.properties.path.replace(/^\/+|\/+$/g, '');
2207
+ formData.append('file', blob, sanitizedPath || 'default_filename');
2209
2208
  queryParams = pressets.length ? new URLSearchParams({
2210
2209
  tags: pressets.join(',')
2211
2210
  }).toString() : '';
2212
2211
  url = queryParams ? "/upload/" + id + "?token=" + token + "&" + queryParams : "/upload/" + id + "?token=" + token;
2213
- _context4.next = 12;
2212
+ _context4.next = 13;
2214
2213
  return effects.call(api.post, url, formData, {
2215
2214
  headers: {
2216
2215
  'Content-Type': 'multipart/form-data'
2217
2216
  }
2218
2217
  });
2219
- case 12:
2220
- _context4.next = 14;
2218
+ case 13:
2219
+ _context4.next = 15;
2221
2220
  return effects.call(api.get, "/training/" + id + "?token=" + token);
2222
- case 14:
2221
+ case 15:
2223
2222
  _yield$call4 = _context4.sent;
2224
2223
  data = _yield$call4.data;
2225
- _context4.next = 18;
2224
+ _context4.next = 19;
2226
2225
  return effects.put(uploadFilesActionSuccess({
2227
2226
  files: data.files
2228
2227
  }));
2229
- case 18:
2230
- _context4.next = 24;
2228
+ case 19:
2229
+ _context4.next = 25;
2231
2230
  break;
2232
- case 20:
2233
- _context4.prev = 20;
2231
+ case 21:
2232
+ _context4.prev = 21;
2234
2233
  _context4.t0 = _context4["catch"](1);
2235
2234
  toast.error({
2236
2235
  title: t.toast.uploadFile.fail.title,
2237
2236
  description: t.toast.uploadFile.fail.description
2238
2237
  });
2239
2238
  console.log('-----------uploadFilesSaga.error------------------->', _context4.t0);
2240
- case 24:
2241
- _context4.prev = 24;
2242
- _context4.next = 27;
2239
+ case 25:
2240
+ _context4.prev = 25;
2241
+ _context4.next = 28;
2243
2242
  return effects.put(commonLoadingFinish());
2244
- case 27:
2245
- return _context4.finish(24);
2246
2243
  case 28:
2244
+ return _context4.finish(25);
2245
+ case 29:
2247
2246
  case "end":
2248
2247
  return _context4.stop();
2249
2248
  }
2250
- }, _marked4, null, [[1, 20, 24, 28]]);
2249
+ }, _marked4, null, [[1, 21, 25, 29]]);
2251
2250
  }
2252
2251
  function TrainingSaga(action) {
2253
2252
  var t, _action$payload5, id, pressets, token, tag, queryParams, _yield$call5, data;