mirror of
https://github.com/fatedier/frp.git
synced 2026-07-16 09:19:17 +08:00
31 lines
954 B
TypeScript
31 lines
954 B
TypeScript
import { buildQueryString, http } from './http'
|
|
import type { V2Page } from './http'
|
|
import type { ClientInfoData, ClientListV2Params } from '../types/client'
|
|
|
|
export const getClients = () => {
|
|
return http.get<ClientInfoData[]>('../api/clients')
|
|
}
|
|
|
|
export const getClientsV2 = (params: ClientListV2Params = {}) => {
|
|
return http.getV2<V2Page<ClientInfoData>>(
|
|
`../api/v2/clients${buildQueryString({
|
|
page: params.page,
|
|
pageSize: params.pageSize,
|
|
status:
|
|
params.status && params.status !== 'all' ? params.status : undefined,
|
|
q: params.q || undefined,
|
|
user: params.user,
|
|
clientID: params.clientID || undefined,
|
|
runID: params.runID || undefined,
|
|
})}`,
|
|
)
|
|
}
|
|
|
|
export const getClient = (key: string) => {
|
|
return http.get<ClientInfoData>(`../api/clients/${key}`)
|
|
}
|
|
|
|
export const getClientV2 = (key: string) => {
|
|
return http.getV2<ClientInfoData>(`../api/v2/clients/${encodeURIComponent(key)}`)
|
|
}
|