2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 23:27:17 +08:00

feat: 数据备份前端

This commit is contained in:
耗子
2024-10-13 22:44:42 +08:00
parent e1bcabec5d
commit f235492f8b
30 changed files with 559 additions and 73 deletions

View File

@@ -0,0 +1,24 @@
import type { AxiosResponse } from 'axios'
import { request } from '@/utils'
export default {
// 获取备份列表
list: (type: string, page: number, limit: number): Promise<AxiosResponse<any>> =>
request.get(`/backup/${type}`, { params: { page, limit } }),
// 创建备份
create: (type: string, target: string, path: string): Promise<AxiosResponse<any>> =>
request.post(`/backup/${type}`, { target, path }),
// 上传备份
upload: (type: string, formData: FormData): Promise<AxiosResponse<any>> => {
return request.post(`/backup/${type}/upload`, formData, {
headers: { 'Content-Type': 'multipart/form-data' }
})
},
// 删除备份
delete: (type: string, file: string): Promise<AxiosResponse<any>> =>
request.delete(`/backup/${type}/delete`, { params: { file } }),
// 恢复备份
restore: (type: string, file: string, target: string): Promise<AxiosResponse<any>> =>
request.post(`/backup/${type}/restore`, { file, target })
}