mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-28 16:56:16 +08:00
feat: add delete backup functionality with confirmation dialog
This commit is contained in:
@@ -13,6 +13,11 @@ export function useBackupManager() {
|
||||
queryFn: () => backupsApi.listDbBackups(),
|
||||
});
|
||||
|
||||
const createMutation = useMutation({
|
||||
mutationFn: () => backupsApi.createDbBackup(),
|
||||
onSuccess: () => refetch(),
|
||||
});
|
||||
|
||||
const restoreMutation = useMutation({
|
||||
mutationFn: (filename: string) => backupsApi.restoreDbBackup(filename),
|
||||
onSuccess: async () => {
|
||||
@@ -34,12 +39,21 @@ export function useBackupManager() {
|
||||
onSuccess: () => refetch(),
|
||||
});
|
||||
|
||||
const deleteMutation = useMutation({
|
||||
mutationFn: (filename: string) => backupsApi.deleteDbBackup(filename),
|
||||
onSuccess: () => refetch(),
|
||||
});
|
||||
|
||||
return {
|
||||
backups,
|
||||
isLoading,
|
||||
create: createMutation.mutateAsync,
|
||||
isCreating: createMutation.isPending,
|
||||
restore: restoreMutation.mutateAsync,
|
||||
isRestoring: restoreMutation.isPending,
|
||||
rename: renameMutation.mutateAsync,
|
||||
isRenaming: renameMutation.isPending,
|
||||
remove: deleteMutation.mutateAsync,
|
||||
isDeleting: deleteMutation.isPending,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user