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