avoid duplicate data

This commit is contained in:
Alireza Ahmadi
2024-05-15 01:44:42 +02:00
parent c0aef193ea
commit 609132a5b1
8 changed files with 36 additions and 0 deletions
+7
View File
@@ -108,6 +108,8 @@ import { computed, ref } from 'vue'
import { InTypes, Inbound, InboundWithUser, ShadowTLS, VLESS } from '@/types/inbounds'
import { Client } from '@/types/clients'
import { Link, LinkUtil } from '@/plugins/link'
import Message from '@/store/modules/message'
import { i18n } from '@/locales'
const appConfig = computed((): Config => {
return <Config> Data().config
@@ -156,6 +158,11 @@ const closeModal = () => {
modal.value.visible = false
}
const saveModal = (data:Inbound, stats: boolean) => {
if (inbounds.value.findIndex(c => c.tag == data.tag) != modal.value.id) {
const sb = Message()
sb.showMessage(i18n.global.t('error.dplData') + ': ' + i18n.global.t('objects.tag') ,'error', 5000)
return
}
// New or Edit
if (modal.value.id == -1) {
inbounds.value.push(data)