diff --git a/client/client.js b/client/client.js index 8823df4f..28f36737 100644 --- a/client/client.js +++ b/client/client.js @@ -7,6 +7,7 @@ const inherits = require('inherits'); const rendy = require('rendy/legacy'); const exec = require('execon'); const load = require('load.js'); +const {promisify} = require('es6-promisify'); const pascalCase = require('just-pascal-case'); const isDev = process.env.NODE_ENV === 'development'; @@ -318,7 +319,7 @@ function CloudCmdProto(DOM) { func(...args); }; - this.refresh = (options = {}, callback) => { + this.refresh = promisify((options = {}, callback) => { if (!callback && typeof options === 'function') { callback = options; options = {}; @@ -340,7 +341,7 @@ function CloudCmdProto(DOM) { noCurrent, currentName, }, callback); - }; + }); /** * Функция загружает json-данные о Файловой Системе diff --git a/client/modules/operation/index.js b/client/modules/operation/index.js index 451ccd25..c96dda52 100644 --- a/client/modules/operation/index.js +++ b/client/modules/operation/index.js @@ -319,15 +319,15 @@ function deleteSilent(files = DOM.getActiveFiles()) { const currentName = DOM.getCurrentName(); const nextCurrentName = getNextCurrentName(currentName, names, removedNames); - deleteFn(path + query, removedNames, () => { - CloudCmd.refresh(() => { - const names = Info.files.map(DOM.getCurrentName); - const isCurrent = names.includes(currentName); - - const name = isCurrent ? currentName : nextCurrentName; - - DOM.setCurrentByName(name); - }); + deleteFn(path + query, removedNames, async () => { + await CloudCmd.refresh(); + + const names = Info.files.map(DOM.getCurrentName); + const isCurrent = names.includes(currentName); + + const name = isCurrent ? currentName : nextCurrentName; + + DOM.setCurrentByName(name); }); } diff --git a/client/modules/user-menu/default-menu.js b/client/modules/user-menu/default-menu.js index ed940249..3a0eaa23 100644 --- a/client/modules/user-menu/default-menu.js +++ b/client/modules/user-menu/default-menu.js @@ -29,7 +29,7 @@ module.exports = { if (e) return Dialog.alert(e); - await tryToPromisify(CloudCmd.refresh); + await CloudCmd.refresh(); DOM.setCurrentByName('.cloudcmd.menu.js'); await CloudCmd.EditFile.show();