<template>
  <confirm
    :title="title"
    :message="message"
    @confirm="confirm"
    @cancel="cancel"
  />
</template>

<script lang="ts">
import Confirm from '@/components/modals/Confirm.vue';

export default {
  components: {
    Confirm,
  },

  computed: {
    title() {
      const { payload } = this.$modal.state;
      if (payload && payload.title) {
        return payload.title;
      }
      return 'Bestätigung';
    },
    message() {
      const { payload } = this.$modal.state;
      if (payload && payload.message) {
        return payload.message;
      }
      return 'Wollen Sie diesen Eintrag wirklich löschen?';
    },
  },

  methods: {
    confirm() {
      this.$modal.confirm();
    },
    cancel() {
      this.$modal.cancel();
    },
  },
};
</script>
