refs #2068 Add delete button for delete list
This commit is contained in:
parent
bd6ca2a4dd
commit
cc3b598ed6
|
@ -387,7 +387,15 @@
|
|||
"lists": {
|
||||
"index": {
|
||||
"new_list": "New List",
|
||||
"edit": "Edit"
|
||||
"edit": "Edit",
|
||||
"delete": {
|
||||
"confirm": {
|
||||
"title": "Confirm",
|
||||
"message": "This operation can not be undone, this list will be permanently deleted",
|
||||
"ok": "Delete",
|
||||
"cancel": "Cancel"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"login": {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
<el-button type="text" @click="edit(list)">
|
||||
<icon name="regular/edit"></icon>
|
||||
</el-button>
|
||||
<el-button type="text" @click="del(list)">
|
||||
<icon name="regular/trash-alt"></icon>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -73,6 +76,17 @@ export default {
|
|||
},
|
||||
edit(list) {
|
||||
return this.$router.push(`/${this.id()}/lists/${list.id}/edit`)
|
||||
},
|
||||
del(list) {
|
||||
this.$confirm(this.$t('lists.index.delete.confirm.message'), this.$t('lists.index.delete.confirm.title'), {
|
||||
confirmButtonText: this.$t('lists.index.delete.confirm.ok'),
|
||||
cancelButtonText: this.$t('lists.index.delete.confirm.cancel'),
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
this.$store.dispatch('TimelineSpace/Contents/Lists/Index/deleteList', list)
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,17 @@ const actions: ActionTree<IndexState, RootState> = {
|
|||
)
|
||||
const res = await client.createList(title)
|
||||
return res.data
|
||||
},
|
||||
deleteList: async ({ dispatch, rootState }, list: Entity.List) => {
|
||||
const client = generator(
|
||||
rootState.TimelineSpace.sns,
|
||||
rootState.TimelineSpace.account.baseURL,
|
||||
rootState.TimelineSpace.account.accessToken,
|
||||
rootState.App.userAgent
|
||||
)
|
||||
const res = await client.deleteList(list.id)
|
||||
dispatch('fetchLists')
|
||||
return res.data
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue