From c8898e6acb8466f7a377fe3713aab4b0cb7ecd6a Mon Sep 17 00:00:00 2001 From: chaos-zhu Date: Mon, 21 Oct 2024 18:55:41 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=AE=9E=E4=BE=8B=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/controller/host.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/app/controller/host.js b/server/app/controller/host.js index 60d2d73..8a110c2 100644 --- a/server/app/controller/host.js +++ b/server/app/controller/host.js @@ -111,7 +111,7 @@ async function updateHost({ res, request }) { // console.log(`${ authType }__commonKey加密存储: `, record[authType]) } hostList.splice(idx, 1, record) - writeHostList(hostList) + await writeHostList(hostList) res.success() } @@ -121,8 +121,8 @@ async function removeHost({ let { body: { ids } } = request let hostList = await readHostList() if (!Array.isArray(ids)) return res.fail({ msg: '参数错误' }) - hostList = hostList.filter(({ id }) => !ids.includes(id)) - writeHostList(hostList) + hostList = hostList.filter(({ _id }) => !ids.includes(_id)) + await writeHostList(hostList) res.success({ data: '已移除' }) } @@ -158,7 +158,7 @@ async function importHost({ }) } hostList.push(...newHostList) - writeHostList(hostList) + await writeHostList(hostList) res.success({ data: { len: newHostList.length } }) }