split uploaded and generated backups
This commit is contained in:
parent
f8fb222ebb
commit
5cb68d92ce
11 changed files with 188 additions and 21 deletions
|
@ -8,13 +8,14 @@ export const useBackupStore = defineStore("backup", {
|
|||
return {
|
||||
backups: [] as Array<string>,
|
||||
loading: null as null | "loading" | "success" | "failed",
|
||||
page: "generated" as "generated" | "uploaded",
|
||||
};
|
||||
},
|
||||
actions: {
|
||||
fetchBackups() {
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get("/admin/backup")
|
||||
.get(`/admin/backup/${this.page}`)
|
||||
.then((result) => {
|
||||
this.backups = result.data;
|
||||
this.loading = "success";
|
||||
|
@ -24,16 +25,16 @@ export const useBackupStore = defineStore("backup", {
|
|||
});
|
||||
},
|
||||
fetchBackupById(filename: string): Promise<AxiosResponse<any, any>> {
|
||||
return http.get(`/admin/backup/${filename}`);
|
||||
return http.get(`/admin/backup/${this.page}/${filename}`);
|
||||
},
|
||||
async restoreBackup(backup: BackupRestoreViewModel): Promise<AxiosResponse<any, any>> {
|
||||
return await http.post(`/admin/backup/${this.page}/restore`, backup);
|
||||
},
|
||||
async triggerBackupCreate(): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post("/admin/backup");
|
||||
this.fetchBackups();
|
||||
return result;
|
||||
},
|
||||
async restoreBackup(backup: BackupRestoreViewModel): Promise<AxiosResponse<any, any>> {
|
||||
return await http.post("/admin/backup/restore", backup);
|
||||
},
|
||||
async uploadBackup(file: File): Promise<AxiosResponse<any, any>> {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue