Add message on cloud delete

This commit is contained in:
SebClem 2024-07-12 17:06:51 +02:00
parent bd0fbe81c2
commit 049beb53b8
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"> <script setup lang="ts">
import { useMenuSize } from "@/composable/menuSize"; import { useMenuSize } from "@/composable/menuSize";
import { deleteWebdabBackup } from "@/services/webdavService"; import { deleteWebdabBackup } from "@/services/webdavService";
import { useAlertStore } from "@/store/alert";
import type { WebdavBackup } from "@/types/webdav"; import type { WebdavBackup } from "@/types/webdav";
import { computed, ref } from "vue"; import { ref } from "vue";
import { useDisplay } from "vuetify/dist/vuetify";
const dialog = ref(false); const dialog = ref(false);
const loading = ref(false); const loading = ref(false);
@ -42,6 +42,11 @@ const item = ref<WebdavBackup | null>(null);
const { width, isFullScreen } = useMenuSize(); const { width, isFullScreen } = useMenuSize();
const emit = defineEmits<{
(e: "deleted"): void;
}>();
const alertStore = useAlertStore();
function confirm() { function confirm() {
loading.value = true; loading.value = true;
if (item.value) { if (item.value) {
@ -49,9 +54,12 @@ function confirm() {
.then(() => { .then(() => {
loading.value = false; loading.value = false;
dialog.value = false; dialog.value = false;
alertStore.add("success", "Backup deleted from cloud");
emit("deleted");
}) })
.catch(() => { .catch(() => {
loading.value = false; loading.value = false;
alertStore.add("error", "Fail to deleted backup from cloud");
}); });
} }
} }

View File

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

View File

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