2021-01-30 16:17:04 +00:00
|
|
|
<template>
|
|
|
|
<modal
|
|
|
|
@close="$router.back()"
|
|
|
|
@submit="deleteList()"
|
|
|
|
>
|
2021-08-19 17:55:13 +00:00
|
|
|
<template #header><span>{{ $t('list.delete.header') }}</span></template>
|
|
|
|
|
|
|
|
<template #text>
|
|
|
|
<p>{{ $t('list.delete.text1') }}<br/>
|
|
|
|
{{ $t('list.delete.text2') }}</p>
|
|
|
|
</template>
|
2021-01-30 16:17:04 +00:00
|
|
|
</modal>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: 'list-setting-delete',
|
|
|
|
created() {
|
|
|
|
const list = this.$store.getters['lists/getListById'](this.$route.params.listId)
|
2021-06-23 23:24:57 +00:00
|
|
|
this.setTitle(this.$t('list.delete.title', {list: list.title}))
|
2021-01-30 16:17:04 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
deleteList() {
|
|
|
|
const list = this.$store.getters['lists/getListById'](this.$route.params.listId)
|
|
|
|
|
2021-07-20 16:03:38 +00:00
|
|
|
this.$store.dispatch('lists/deleteList', list)
|
2021-01-30 16:17:04 +00:00
|
|
|
.then(() => {
|
2021-08-25 10:28:29 +00:00
|
|
|
this.$message.success({message: this.$t('list.delete.success')})
|
2021-01-30 16:17:04 +00:00
|
|
|
this.$router.push({name: 'home'})
|
|
|
|
})
|
|
|
|
.catch(e => {
|
2021-08-25 10:28:29 +00:00
|
|
|
this.$message.error(e)
|
2021-01-30 16:17:04 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|