fix deletion event

This commit is contained in:
srgooglo 2022-11-14 02:44:23 +00:00
parent 4da4583101
commit 19d8be3672
2 changed files with 8 additions and 4 deletions

View File

@ -21,9 +21,11 @@ export default class ExplorePosts extends React.Component {
posts: [data, ...this.state.posts], posts: [data, ...this.state.posts],
}) })
}, },
"post.delete": async (data) => { "post.delete": async (id) => {
this.setState({ this.setState({
posts: this.state.posts.filter((post) => post.id !== data.id), posts: this.state.posts.filter((post) => {
return post._id !== id
}),
}) })
} }
} }

View File

@ -32,9 +32,11 @@ export default class Feed extends React.Component {
posts: [data, ...this.state.posts], posts: [data, ...this.state.posts],
}) })
}, },
"post.delete": async (data) => { "post.delete": async (id) => {
this.setState({ this.setState({
posts: this.state.posts.filter((post) => post.id !== data.id), posts: this.state.posts.filter((post) => {
return post._id !== id
}),
}) })
} }
} }