fix: config hot update

This commit is contained in:
idranme
2024-10-15 11:51:00 +08:00
parent c837e970df
commit 39fda24799
4 changed files with 67 additions and 66 deletions

View File

@@ -7,7 +7,6 @@ import {
CHANNEL_SELECT_FILE,
CHANNEL_SET_CONFIG,
CHANNEL_UPDATE,
CHANNEL_SET_CONFIG_CONFIRMED,
} from './common/channels'
const { contextBridge } = require('electron')
@@ -24,8 +23,7 @@ const llonebot = {
return ipcRenderer.invoke(CHANNEL_UPDATE)
},
setConfig: async (ask: boolean, config: Config) => {
const isSuccess = await ipcRenderer.invoke(CHANNEL_SET_CONFIG, ask, config)
if (isSuccess) ipcRenderer.send(CHANNEL_SET_CONFIG_CONFIRMED, config)
return ipcRenderer.invoke(CHANNEL_SET_CONFIG, ask, config)
},
getConfig: async (): Promise<Config> => {
return ipcRenderer.invoke(CHANNEL_GET_CONFIG)