From 5b8b7833ca4c8f35da541c82ddcf511129fdc602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E7=95=85?= Date: Fri, 16 Dec 2022 18:22:15 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20setSettings=20reset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit setSettings and reset result is undefind --- lib/win32/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/win32/index.js b/lib/win32/index.js index 6a9dee3..f6d7972 100644 --- a/lib/win32/index.js +++ b/lib/win32/index.js @@ -34,6 +34,7 @@ function setSettingValue(value) { if (err) { return reject(err); } + // result is undefind return resolve(result); }); }); @@ -69,7 +70,8 @@ module.exports = { } if (typeof cb === 'function') { try { - return cb(null, await setSettingValue(settings)); + await setSettingValue(settings); + return cb(null, await getSettings()); } catch (e) { return cb(e, null); } @@ -77,11 +79,14 @@ module.exports = { /** * 不传入 callback, 使用 Promise */ - return await setSettingValue(settings); + await setSettingValue(settings); + return await getSettings(); }, reset: async (cb) => { + /** get and return default settings */ if (!defaultConnectionSettings) { - return; + await init() + return defaultConnectionSettings; } if (typeof cb === 'function') { try {