fix(webui): name重复问题

This commit is contained in:
bietiaop
2025-02-01 11:44:30 +08:00
parent c0dd8a53e8
commit e6968f2d80

View File

@@ -14,10 +14,12 @@ const useConfig = () => {
key: T, key: T,
value: OneBotConfig['network'][T][0] value: OneBotConfig['network'][T][0]
) => { ) => {
if ( const allNetworkNames = Object.keys(config.network).reduce((acc, key) => {
value.name && const _key = key as keyof OneBotConfig['network']
config.network[key].some((item) => item.name === value.name) return acc.concat(config.network[_key].map((item) => item.name))
) { }, [] as string[])
if (value.name && allNetworkNames.includes(value.name)) {
throw new Error('已经存在相同的配置项名') throw new Error('已经存在相同的配置项名')
} }