diff --git a/webapp/components/_new/features/SearchResults/SearchResults.vue b/webapp/components/_new/features/SearchResults/SearchResults.vue index c1140424f..1280ba481 100644 --- a/webapp/components/_new/features/SearchResults/SearchResults.vue +++ b/webapp/components/_new/features/SearchResults/SearchResults.vue @@ -13,9 +13,6 @@ - - - @@ -29,6 +26,9 @@ + + + diff --git a/webapp/mixins/postActions.js b/webapp/mixins/postActions.js new file mode 100644 index 000000000..bf77cc300 --- /dev/null +++ b/webapp/mixins/postActions.js @@ -0,0 +1,39 @@ +export default { + methods: { + deletePost(deletedPost) { + this.posts = this.posts.filter((post) => { + return post.id !== deletedPost.id + }) + }, + pinPost(post) { + this.$apollo + .mutate({ + mutation: PostMutations().pinPost, + variables: { + id: post.id + }, + }) + .then(() => { + this.$toast.success(this.$t('post.menu.pinnedSuccessfully')) + this.resetPostList() + this.$apollo.queries.Post.refetch() + }) + .catch((error) => this.$toast.error(error.message)) + }, + unpinPost(post) { + this.$apollo + .mutate({ + mutation: PostMutations().unpinPost, + variables: { + id: post.id + }, + }) + .then(() => { + this.$toast.success(this.$t('post.menu.unpinnedSuccessfully')) + this.resetPostList() + this.$apollo.queries.Post.refetch() + }) + .catch((error) => this.$toast.error(error.message)) + }, + }, +} diff --git a/webapp/pages/index.vue b/webapp/pages/index.vue index e6504cc7a..1bb08ebbd 100644 --- a/webapp/pages/index.vue +++ b/webapp/pages/index.vue @@ -64,6 +64,7 @@