2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-06 11:23:44 +08:00

feat: axios转alova.js

This commit is contained in:
耗子
2025-02-04 23:52:36 +08:00
parent 06d620ac06
commit d25c035fc0
7 changed files with 47 additions and 84 deletions

View File

@@ -1,9 +1,6 @@
import type { AxiosResponse } from 'axios'
import { request } from '@/utils'
import { http } from '@/utils'
export default {
// 运行评分
test: (name: string, multi: boolean): Promise<AxiosResponse<any>> =>
request.post('/apps/benchmark/test', { name, multi })
test: (name: string, multi: boolean): any => http.Post('/apps/benchmark/test', { name, multi })
}

View File

@@ -1,4 +1,6 @@
import { http } from '@/utils'
export const getConfig = () => http.Get('/apps/docker/config')
export const updateConfig = (config: string) => http.Post('/apps/docker/config', { config })
export default {
getConfig: (): any => http.Get('/apps/docker/config'),
updateConfig: (config: string): any => http.Post('/apps/docker/config', { config })
}

View File

@@ -1,24 +1,19 @@
import type { AxiosResponse } from 'axios'
import { request } from '@/utils'
import { http } from '@/utils'
export default {
// 保护列表
jails: (page: number, limit: number): Promise<AxiosResponse<any>> =>
request.get('/apps/fail2ban/jails', { params: { page, limit } }),
jails: (page: number, limit: number): any =>
http.Get('/apps/fail2ban/jails', { params: { page, limit } }),
// 添加保护
add: (data: any): Promise<AxiosResponse<any>> => request.post('/apps/fail2ban/jails', data),
add: (data: any): any => http.Post('/apps/fail2ban/jails', data),
// 删除保护
delete: (name: string): Promise<AxiosResponse<any>> =>
request.delete('/apps/fail2ban/jails', { data: { name } }),
delete: (name: string): any => http.Delete('/apps/fail2ban/jails', { name }),
// 封禁列表
jail: (name: string): Promise<AxiosResponse<any>> => request.get('/apps/fail2ban/jails/' + name),
jail: (name: string): any => http.Get('/apps/fail2ban/jails/' + name),
// 解封 IP
unban: (name: string, ip: string): Promise<AxiosResponse<any>> =>
request.post('/apps/fail2ban/unban', { name, ip }),
unban: (name: string, ip: string): any => http.Post('/apps/fail2ban/unban', { name, ip }),
// 获取白名单
whitelist: (): Promise<AxiosResponse<any>> => request.get('/apps/fail2ban/whiteList'),
whitelist: (): any => http.Get('/apps/fail2ban/whiteList'),
// 设置白名单
setWhitelist: (ip: string): Promise<AxiosResponse<any>> =>
request.post('/apps/fail2ban/whiteList', { ip })
setWhitelist: (ip: string): any => http.Post('/apps/fail2ban/whiteList', { ip })
}