code7-leia 0.2.13 → 0.2.17
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/dist/code7-leia.cjs.development.js +22 -18
- package/dist/code7-leia.cjs.development.js.map +1 -1
- package/dist/code7-leia.cjs.production.min.js +1 -1
- package/dist/code7-leia.cjs.production.min.js.map +1 -1
- package/dist/code7-leia.esm.js +22 -18
- package/dist/code7-leia.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/store/modules/sagas.ts +5 -1
|
@@ -2191,7 +2191,7 @@ function testSaga(action) {
|
|
|
2191
2191
|
}, _marked3, null, [[0, 12, 15, 19]]);
|
|
2192
2192
|
}
|
|
2193
2193
|
function uploadFilesSaga(action) {
|
|
2194
|
-
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;
|
|
2195
2195
|
return _regeneratorRuntime().wrap(function uploadFilesSaga$(_context4) {
|
|
2196
2196
|
while (1) switch (_context4.prev = _context4.next) {
|
|
2197
2197
|
case 0:
|
|
@@ -2203,49 +2203,53 @@ function uploadFilesSaga(action) {
|
|
|
2203
2203
|
_action$payload4 = action.payload, id = _action$payload4.id, file = _action$payload4.file, pressets = _action$payload4.pressets, token = _action$payload4.token;
|
|
2204
2204
|
blob = new Blob([file.content]);
|
|
2205
2205
|
formData = new FormData();
|
|
2206
|
-
|
|
2206
|
+
sanitizedPath = file.properties.path.replace(/^\/+|\/+$/g, '');
|
|
2207
|
+
console.log('sanitizedPath: ', sanitizedPath);
|
|
2208
|
+
formData.append('file', blob, sanitizedPath || 'default_filename');
|
|
2209
|
+
console.log('formData: ', formData);
|
|
2210
|
+
console.log('file: ', file);
|
|
2207
2211
|
queryParams = pressets.length ? new URLSearchParams({
|
|
2208
2212
|
tags: pressets.join(',')
|
|
2209
2213
|
}).toString() : '';
|
|
2210
2214
|
url = queryParams ? "/upload/" + id + "?token=" + token + "&" + queryParams : "/upload/" + id + "?token=" + token;
|
|
2211
|
-
_context4.next =
|
|
2215
|
+
_context4.next = 16;
|
|
2212
2216
|
return effects.call(api.post, url, formData, {
|
|
2213
2217
|
headers: {
|
|
2214
2218
|
'Content-Type': 'multipart/form-data'
|
|
2215
2219
|
}
|
|
2216
2220
|
});
|
|
2217
|
-
case
|
|
2218
|
-
_context4.next =
|
|
2221
|
+
case 16:
|
|
2222
|
+
_context4.next = 18;
|
|
2219
2223
|
return effects.call(api.get, "/training/" + id + "?token=" + token);
|
|
2220
|
-
case
|
|
2224
|
+
case 18:
|
|
2221
2225
|
_yield$call4 = _context4.sent;
|
|
2222
2226
|
data = _yield$call4.data;
|
|
2223
|
-
_context4.next =
|
|
2227
|
+
_context4.next = 22;
|
|
2224
2228
|
return effects.put(uploadFilesActionSuccess({
|
|
2225
2229
|
files: data.files
|
|
2226
2230
|
}));
|
|
2227
|
-
case
|
|
2228
|
-
_context4.next =
|
|
2231
|
+
case 22:
|
|
2232
|
+
_context4.next = 28;
|
|
2229
2233
|
break;
|
|
2230
|
-
case
|
|
2231
|
-
_context4.prev =
|
|
2234
|
+
case 24:
|
|
2235
|
+
_context4.prev = 24;
|
|
2232
2236
|
_context4.t0 = _context4["catch"](1);
|
|
2233
2237
|
toast.error({
|
|
2234
2238
|
title: t.toast.uploadFile.fail.title,
|
|
2235
2239
|
description: t.toast.uploadFile.fail.description
|
|
2236
2240
|
});
|
|
2237
2241
|
console.log('-----------uploadFilesSaga.error------------------->', _context4.t0);
|
|
2238
|
-
case 24:
|
|
2239
|
-
_context4.prev = 24;
|
|
2240
|
-
_context4.next = 27;
|
|
2241
|
-
return effects.put(commonLoadingFinish());
|
|
2242
|
-
case 27:
|
|
2243
|
-
return _context4.finish(24);
|
|
2244
2242
|
case 28:
|
|
2243
|
+
_context4.prev = 28;
|
|
2244
|
+
_context4.next = 31;
|
|
2245
|
+
return effects.put(commonLoadingFinish());
|
|
2246
|
+
case 31:
|
|
2247
|
+
return _context4.finish(28);
|
|
2248
|
+
case 32:
|
|
2245
2249
|
case "end":
|
|
2246
2250
|
return _context4.stop();
|
|
2247
2251
|
}
|
|
2248
|
-
}, _marked4, null, [[1,
|
|
2252
|
+
}, _marked4, null, [[1, 24, 28, 32]]);
|
|
2249
2253
|
}
|
|
2250
2254
|
function TrainingSaga(action) {
|
|
2251
2255
|
var t, _action$payload5, id, pressets, token, tag, queryParams, _yield$call5, data;
|