fix: Fix issue with duplicate nodes appearing after adding a node. (#8828)

This commit is contained in:
CityFun 2025-05-26 13:33:39 +08:00 committed by GitHub
parent 06d88219c2
commit a36c0eb22f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -33,38 +33,37 @@ const em = defineEmits(['update:withDockerRestart', 'submit']);
interface DialogProps { interface DialogProps {
syncList: string; syncList: string;
} }
const emit = () => {
em('update:withDockerRestart', false);
em('submit');
};
const acceptParams = async (props: DialogProps): Promise<void> => { const acceptParams = async (props: DialogProps): Promise<void> => {
if (props.syncList.indexOf('SyncSystemProxy') === -1) { if (props.syncList.indexOf('SyncSystemProxy') === -1) {
em('update:withDockerRestart', false); emit();
em('submit');
return; return;
} }
await getSettingInfo() try {
.then((res) => { const res = await getSettingInfo();
if (res.data.proxyType === '' || res.data.proxyType === 'close') { if (res.data.proxyType === '' || res.data.proxyType === 'close') {
em('update:withDockerRestart', false); emit();
em('submit');
return; return;
} }
}) } catch (error) {
.catch(() => { emit();
em('update:withDockerRestart', false);
em('submit');
return; return;
}); }
let searchXSetting; let searchXSetting;
const xpackModules = import.meta.glob('../../xpack/api/modules/setting.ts', { eager: true }); const xpackModules = import.meta.glob('../../xpack/api/modules/setting.ts', { eager: true });
if (xpackModules['../../xpack/api/modules/setting.ts']) { if (xpackModules['../../xpack/api/modules/setting.ts']) {
searchXSetting = xpackModules['../../xpack/api/modules/setting.ts']['searchXSetting'] || {}; searchXSetting = xpackModules['../../xpack/api/modules/setting.ts']['searchXSetting'] || {};
const res = await searchXSetting(); const res = await searchXSetting();
if (!res) { if (!res) {
em('update:withDockerRestart', false); emit();
em('submit');
return; return;
} }
if (res.data.proxyDocker === '') { if (res.data.proxyDocker === '') {
em('update:withDockerRestart', false); emit();
em('submit');
return; return;
} }
open.value = true; open.value = true;