improve actions handling & behavior

This commit is contained in:
srgooglo 2022-10-11 23:48:20 +02:00
parent c512c97521
commit 80bde65a43

View File

@ -184,13 +184,18 @@ export default class PostsFeed extends React.Component {
} }
onDeletePost = async (data) => { onDeletePost = async (data) => {
let result = await this.api.delete.post({ post_id: data._id }).catch(() => { antd.Modal.confirm({
antd.message.error("Failed to delete post") title: "Are you sure you want to delete this post?",
content: "This action is irreversible",
return false okText: "Yes",
okType: "danger",
cancelText: "No",
onOk: async () => {
await this.api.delete.post({ post_id: data._id }).catch(() => {
antd.message.error("Failed to delete post")
})
},
}) })
return result
} }
onDoubleClickPost = (data) => { onDoubleClickPost = (data) => {