diff --git a/public/js/app.js b/public/js/app.js index 04e1266..4485456 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -2471,53 +2471,38 @@ var ProcessFile = /*#__PURE__*/function (_Vue) { }, { key: "runSearchers", value: function () { - var _runSearchers = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee3() { + var _runSearchers = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee2() { var _this2 = this; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee3$(_context3) { + var searchers, response; + return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) { while (1) { - switch (_context3.prev = _context3.next) { + switch (_context2.prev = _context2.next) { case 0: this.processing = true; this.processedFileContent = ''; - setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee2() { - var searchers, response; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) { - while (1) { - switch (_context2.prev = _context2.next) { - case 0: - searchers = []; - - _this2.selectedSearchers.forEach(function (searcher) { - searchers.push({ - 'key': searcher.id, - 'replace_with': _this2.searchersOptions[searcher.id] || '' - }); - }); - - _context2.next = 4; - return _this2.$api.filterDocument(_this2.fileContent, searchers); - - case 4: - response = _context2.sent; - console.log(response); - _this2.processedFileContent = response.content; - _this2.processing = false; + searchers = []; + this.selectedSearchers.forEach(function (searcher) { + searchers.push({ + 'key': searcher.id, + 'replace_with': _this2.searchersOptions[searcher.id] || '' + }); + }); + _context2.next = 6; + return this.$api.filterDocument(this.fileContent, searchers); - case 8: - case "end": - return _context2.stop(); - } - } - }, _callee2); - })), 2500); + case 6: + response = _context2.sent; + console.log(response); + this.processedFileContent = response.content; + this.processing = false; - case 3: + case 10: case "end": - return _context3.stop(); + return _context2.stop(); } } - }, _callee3, this); + }, _callee2, this); })); function runSearchers() { @@ -2529,25 +2514,25 @@ var ProcessFile = /*#__PURE__*/function (_Vue) { }, { key: "downloadOdt", value: function () { - var _downloadOdt = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee4() { + var _downloadOdt = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee3() { var response; - return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee4$(_context4) { + return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee3$(_context3) { while (1) { - switch (_context4.prev = _context4.next) { + switch (_context3.prev = _context3.next) { case 0: - _context4.next = 2; + _context3.next = 2; return this.$api.convertFile(this.processedFileContent); case 2: - response = _context4.sent; + response = _context3.sent; window.open('http://core.sandd/file/download/' + response.path); case 4: case "end": - return _context4.stop(); + return _context3.stop(); } } - }, _callee4, this); + }, _callee3, this); })); function downloadOdt() { diff --git a/resources/js/components/ProcessFile/ProcessFile.ts b/resources/js/components/ProcessFile/ProcessFile.ts index cb58774..ea030db 100644 --- a/resources/js/components/ProcessFile/ProcessFile.ts +++ b/resources/js/components/ProcessFile/ProcessFile.ts @@ -136,25 +136,20 @@ export default class ProcessFile extends Vue { this.processing = true; this.processedFileContent = ''; - setTimeout( - async () => { - let searchers: Array<{ key: string; replace_with: string; }> = []; - this.selectedSearchers.forEach( (searcher) => { - searchers.push({ - 'key': searcher.id, - 'replace_with': this.searchersOptions[searcher.id] || '' - }); - }); + let searchers: Array<{ key: string; replace_with: string; }> = []; + this.selectedSearchers.forEach( (searcher) => { + searchers.push({ + 'key': searcher.id, + 'replace_with': this.searchersOptions[searcher.id] || '' + }); + }); - const response = await this.$api.filterDocument(this.fileContent, searchers); + const response = await this.$api.filterDocument(this.fileContent, searchers); - console.log(response); + console.log(response); - this.processedFileContent = response.content; - this.processing = false; - }, - 2500 - ); + this.processedFileContent = response.content; + this.processing = false; } private async downloadOdt()