mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix(webui): name重复问题
This commit is contained in:
@@ -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('已经存在相同的配置项名')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user