Files
jandl-taskmanager-app/app/src/plugins/tm@modal/task/z-delete-task-modal.vue
T

60 lines
1.1 KiB
Vue

<template>
<v-dialog v-model="show" max-width="650">
<v-card>
<div class="d-flex justify-space-between align-center">
<h1>Ste si istý, že chcete zmazať <b>{{ task.title }}</b>?</h1>
<v-icon
@click.stop="show = false"
icon="mdi-close"
size="large"
></v-icon>
</div>
<v-card-actions class="mt-10 d-flex justify-start align-center">
<v-btn class="z-btn" variant="flat" @click="deleteTask()">ÁNO</v-btn>
<v-btn class="ml-7 cancel-btn" @click.stop="show = false">ZRUŠIŤ</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
export default {
emits: ['close'],
props: {
visible: {
type: Boolean,
required: true
},
task: {
type: Object,
required: true
}
},
methods: {
async deleteTask() {
try {
await this.$axios.delete(`v1/tasks/${this.task.id}`)
this.show = false
} catch (error) {
this.$toast.error(error)
}
}
},
computed: {
show: {
get() {
return this.visible
},
set(value) {
if (!value) this.$emit('close')
}
},
}
}
</script>