Add message on cloud delete

This commit is contained in:
SebClem 2024-07-12 17:06:51 +02:00
parent 8510115686
commit c043f27f93
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50
3 changed files with 14 additions and 4 deletions

View File

@ -32,9 +32,9 @@
<script setup lang="ts">
import { useMenuSize } from "@/composable/menuSize";
import { deleteWebdabBackup } from "@/services/webdavService";
import { useAlertStore } from "@/store/alert";
import type { WebdavBackup } from "@/types/webdav";
import { computed, ref } from "vue";
import { useDisplay } from "vuetify/dist/vuetify";
import { ref } from "vue";
const dialog = ref(false);
const loading = ref(false);
@ -42,6 +42,11 @@ const item = ref<WebdavBackup | null>(null);
const { width, isFullScreen } = useMenuSize();
const emit = defineEmits<{
(e: "deleted"): void;
}>();
const alertStore = useAlertStore();
function confirm() {
loading.value = true;
if (item.value) {
@ -49,9 +54,12 @@ function confirm() {
.then(() => {
loading.value = false;
dialog.value = false;
alertStore.add("success", "Backup deleted from cloud");
emit("deleted");
})
.catch(() => {
loading.value = false;
alertStore.add("error", "Fail to deleted backup from cloud");
});
}
}

View File

@ -76,7 +76,10 @@
</v-row>
</v-card-text>
</v-card>
<cloud-delete-dialog ref="deleteDialog"></cloud-delete-dialog>
<cloud-delete-dialog
ref="deleteDialog"
@deleted="refreshBackup"
></cloud-delete-dialog>
</div>
</template>

View File

@ -69,4 +69,3 @@ function saved() {
alertStore.add("success", "Backup settings saved !");
}
</script>
@/store/dialogStatus@/store/alert