备份与恢复
This commit is contained in:
1 parent
5d5fecde1b
commit
b4535d6aea
6 files changed
+252
-27
No files matched your search
@@ -204,12 +204,17 @@ export function useBackup() {
|
||||
archiveName?: string
|
||||
}): Promise<BackupRestorePreview> {
|
||||
if (input.file) {
|
||||
const form = new FormData()
|
||||
form.append('file', input.file)
|
||||
form.append('dryRun', 'true')
|
||||
const data = await $fetch<{ preview: BackupRestorePreview }>(
|
||||
'/api/admin/backup/restore',
|
||||
{ method: 'POST', credentials: 'include', body: form }
|
||||
{
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
body: input.file,
|
||||
headers: {
|
||||
'content-type': 'application/octet-stream',
|
||||
'x-pichost-dry-run': 'true'
|
||||
}
|
||||
}
|
||||
)
|
||||
return data.preview
|
||||
}
|
||||
@@ -235,12 +240,18 @@ export function useBackup() {
|
||||
}) {
|
||||
try {
|
||||
if (input.file) {
|
||||
const form = new FormData()
|
||||
form.append('file', input.file)
|
||||
form.append('conflictMode', input.conflictMode)
|
||||
const data = await $fetch<{ job: BackupJobItem }>(
|
||||
'/api/admin/backup/restore',
|
||||
{ method: 'POST', credentials: 'include', body: form }
|
||||
{
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
body: input.file,
|
||||
headers: {
|
||||
'content-type': 'application/octet-stream',
|
||||
'x-pichost-dry-run': 'false',
|
||||
'x-pichost-conflict-mode': input.conflictMode
|
||||
}
|
||||
}
|
||||
)
|
||||
await refreshJobsFirstPage()
|
||||
startPolling()
|
||||
|
||||
Reference in new issue
Block a user