添加 Speed/updateBuild.ts

This commit is contained in:
ste87 2026-03-14 23:03:37 +08:00
parent 734869eb26
commit 0bd1398085

40
Speed/updateBuild.ts Normal file
View File

@ -0,0 +1,40 @@
import { rawDataToAdminServer } from '@/api/admin/servers/getServer'
import http from '@/api/http'
interface UpdateServerBuildParameters {
cpu: number
memory: number
disk: number
addressIds: number[]
snapshotLimit: number | null
backupLimit: number | null
bandwidthLimit: number | null
bandwidthUsage: number
}
const updateBuild = async (
serverUuid: string,
{
addressIds,
snapshotLimit,
backupLimit,
bandwidthLimit,
bandwidthUsage,
...params
}: UpdateServerBuildParameters
) => {
const {
data: { data },
} = await http.patch(`/api/admin/servers/${serverUuid}/settings/build`, {
address_ids: addressIds,
snapshot_limit: snapshotLimit,
backup_limit: backupLimit,
bandwidth_limit: bandwidthLimit,
bandwidth_usage: bandwidthUsage,
...params,
})
return rawDataToAdminServer(data)
}
export default updateBuild