mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 23:27:17 +08:00
feat: 数据备份前端
This commit is contained in:
24
web/src/api/panel/backup/index.ts
Normal file
24
web/src/api/panel/backup/index.ts
Normal 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 })
|
||||
}
|
||||
Reference in New Issue
Block a user