Files
homebox/frontend/components/ModalConfirm.vue
2025-08-29 13:46:45 +01:00

48 lines
1.2 KiB
Vue

<template>
<AlertDialog :open="isRevealed">
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>{{ $t("global.confirm") }}</AlertDialogTitle>
<AlertDialogDescription> {{ text || $t("global.delete_confirm") }} </AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel @click="cancel(false)">
{{ $t("global.cancel") }}
</AlertDialogCancel>
<AlertDialogAction @click="confirm(true)">
{{ $t("global.confirm") }}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</template>
<script setup lang="ts">
import { useDialog } from "./ui/dialog-provider";
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
const { text, isRevealed, confirm, cancel } = useConfirm();
const { addAlert, removeAlert } = useDialog();
watch(
isRevealed,
val => {
if (val) {
addAlert("confirm-modal");
} else {
removeAlert("confirm-modal");
}
},
{ immediate: true }
);
</script>