only table in clients page & better load and save

This commit is contained in:
Alireza Ahmadi
2025-01-18 10:28:04 +01:00
parent 67582015d3
commit f18345b30d
14 changed files with 91 additions and 259 deletions
+11 -3
View File
@@ -5,6 +5,7 @@ import { i18n } from '@/locales'
import { Inbound } from '@/types/inbounds'
import { Outbound } from '@/types/outbounds'
import { Endpoint } from '@/types/endpoints'
import { Client } from '@/types/clients'
const Data = defineStore('Data', {
state: () => ({
@@ -13,10 +14,10 @@ const Data = defineStore('Data', {
subURI: "",
onlines: {inbound: <string[]>[], outbound: <string[]>[], user: <string[]>[]},
config: <any>{},
inbounds: <Inbound[]>[],
inbounds: <any[]>[],
outbounds: <Outbound[]>[],
endpoints: <Endpoint[]>[],
clients: [],
clients: <any>[],
tlsConfigs: <any[]>[],
}),
actions: {
@@ -55,7 +56,14 @@ const Data = defineStore('Data', {
}
return <Inbound[]>[]
},
async save (object: string, action: string, data: any): Promise<boolean> {
async loadClients(id: number): Promise<Client> {
const options = id > 0 ? {id: id} : {}
const msg = await HttpUtils.get('api/clients', options)
if(msg.success) {
return <Client>msg.obj.clients[0]??{}
}
return <Client>{}
},
let postData = {
object: object,
action: action,