mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
removed console statement
This commit is contained in:
parent
1c43d5fe6f
commit
e7d0e1b61e
@ -64,164 +64,163 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// import DonationInfo from '~/components/DonationInfo/DonationInfo.vue'
|
// import DonationInfo from '~/components/DonationInfo/DonationInfo.vue'
|
||||||
import FilterMenu from '~/components/FilterMenu/FilterMenu.vue'
|
import FilterMenu from '~/components/FilterMenu/FilterMenu.vue'
|
||||||
import HcEmpty from '~/components/Empty/Empty'
|
import HcEmpty from '~/components/Empty/Empty'
|
||||||
import PostTeaser from '~/components/PostTeaser/PostTeaser.vue'
|
import PostTeaser from '~/components/PostTeaser/PostTeaser.vue'
|
||||||
import MasonryGrid from '~/components/MasonryGrid/MasonryGrid.vue'
|
import MasonryGrid from '~/components/MasonryGrid/MasonryGrid.vue'
|
||||||
import MasonryGridItem from '~/components/MasonryGrid/MasonryGridItem.vue'
|
import MasonryGridItem from '~/components/MasonryGrid/MasonryGridItem.vue'
|
||||||
import { mapGetters, mapMutations } from 'vuex'
|
import { mapGetters, mapMutations } from 'vuex'
|
||||||
import { filterPosts } from '~/graphql/PostQuery.js'
|
import { filterPosts } from '~/graphql/PostQuery.js'
|
||||||
import PostMutations from '~/graphql/PostMutations'
|
import PostMutations from '~/graphql/PostMutations'
|
||||||
import UpdateQuery from '~/components/utils/UpdateQuery'
|
import UpdateQuery from '~/components/utils/UpdateQuery'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
// DonationInfo,
|
// DonationInfo,
|
||||||
FilterMenu,
|
FilterMenu,
|
||||||
PostTeaser,
|
PostTeaser,
|
||||||
HcEmpty,
|
HcEmpty,
|
||||||
MasonryGrid,
|
MasonryGrid,
|
||||||
MasonryGridItem,
|
MasonryGridItem,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
const { hashtag = null } = this.$route.query
|
const { hashtag = null } = this.$route.query
|
||||||
console.log(this.$route.query)
|
return {
|
||||||
return {
|
posts: [],
|
||||||
posts: [],
|
hasMore: true,
|
||||||
hasMore: true,
|
// Initialize your apollo data
|
||||||
// Initialize your apollo data
|
offset: 0,
|
||||||
offset: 0,
|
pageSize: 12,
|
||||||
pageSize: 12,
|
hashtag,
|
||||||
hashtag,
|
}
|
||||||
}
|
},
|
||||||
},
|
computed: {
|
||||||
computed: {
|
...mapGetters({
|
||||||
...mapGetters({
|
postsFilter: 'posts/filter',
|
||||||
postsFilter: 'posts/filter',
|
orderOptions: 'posts/orderOptions',
|
||||||
orderOptions: 'posts/orderOptions',
|
orderBy: 'posts/orderBy',
|
||||||
orderBy: 'posts/orderBy',
|
selectedOrder: 'posts/selectedOrder',
|
||||||
selectedOrder: 'posts/selectedOrder',
|
sortingIcon: 'posts/orderIcon',
|
||||||
sortingIcon: 'posts/orderIcon',
|
}),
|
||||||
}),
|
selected: {
|
||||||
selected: {
|
get() {
|
||||||
get() {
|
return this.selectedOrder(this)
|
||||||
return this.selectedOrder(this)
|
},
|
||||||
},
|
set({ value }) {
|
||||||
set({ value }) {
|
this.offset = 0
|
||||||
this.offset = 0
|
this.posts = []
|
||||||
this.posts = []
|
this.selectOrder(value)
|
||||||
this.selectOrder(value)
|
},
|
||||||
},
|
},
|
||||||
},
|
sortingOptions() {
|
||||||
sortingOptions() {
|
return this.orderOptions(this)
|
||||||
return this.orderOptions(this)
|
},
|
||||||
},
|
finalFilters() {
|
||||||
finalFilters() {
|
let filter = this.postsFilter
|
||||||
let filter = this.postsFilter
|
if (this.hashtag) {
|
||||||
if (this.hashtag) {
|
filter = {
|
||||||
filter = {
|
...filter,
|
||||||
...filter,
|
tags_some: { id: this.hashtag },
|
||||||
tags_some: { id: this.hashtag },
|
}
|
||||||
}
|
}
|
||||||
}
|
return filter
|
||||||
return filter
|
},
|
||||||
},
|
hasResults() {
|
||||||
hasResults() {
|
return this.$apollo.loading || (this.posts && this.posts.length > 0)
|
||||||
return this.$apollo.loading || (this.posts && this.posts.length > 0)
|
},
|
||||||
},
|
},
|
||||||
},
|
watch: {
|
||||||
watch: {
|
'$route.query.hashtag'() {
|
||||||
'$route.query.hashtag'() {
|
this.hashtag = this.$route.query.hashtag ? this.$route.query.hashtag : null
|
||||||
this.hashtag = this.$route.query.hashtag
|
},
|
||||||
},
|
},
|
||||||
},
|
methods: {
|
||||||
methods: {
|
...mapMutations({
|
||||||
...mapMutations({
|
selectOrder: 'posts/SELECT_ORDER',
|
||||||
selectOrder: 'posts/SELECT_ORDER',
|
}),
|
||||||
}),
|
clearSearch() {
|
||||||
clearSearch() {
|
this.$router.push({ path: '/' })
|
||||||
this.$router.push({ path: '/' })
|
this.hashtag = null
|
||||||
this.hashtag = null
|
},
|
||||||
},
|
href(post) {
|
||||||
href(post) {
|
return this.$router.resolve({
|
||||||
return this.$router.resolve({
|
name: 'post-id-slug',
|
||||||
name: 'post-id-slug',
|
params: { id: post.id, slug: post.slug },
|
||||||
params: { id: post.id, slug: post.slug },
|
}).href
|
||||||
}).href
|
},
|
||||||
},
|
showMoreContributions($state) {
|
||||||
showMoreContributions($state) {
|
const { Post: PostQuery } = this.$apollo.queries
|
||||||
const { Post: PostQuery } = this.$apollo.queries
|
if (!PostQuery) return // seems this can be undefined on subpages
|
||||||
if (!PostQuery) return // seems this can be undefined on subpages
|
|
||||||
|
|
||||||
this.offset += this.pageSize
|
this.offset += this.pageSize
|
||||||
PostQuery.fetchMore({
|
PostQuery.fetchMore({
|
||||||
variables: {
|
variables: {
|
||||||
offset: this.offset,
|
offset: this.offset,
|
||||||
filter: this.finalFilters,
|
filter: this.finalFilters,
|
||||||
first: this.pageSize,
|
first: this.pageSize,
|
||||||
orderBy: ['pinned_asc', this.orderBy],
|
orderBy: ['pinned_asc', this.orderBy],
|
||||||
},
|
},
|
||||||
updateQuery: UpdateQuery(this, { $state, pageKey: 'Post' }),
|
updateQuery: UpdateQuery(this, { $state, pageKey: 'Post' }),
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
deletePost(deletedPost) {
|
deletePost(deletedPost) {
|
||||||
this.posts = this.posts.filter(post => {
|
this.posts = this.posts.filter(post => {
|
||||||
return post.id !== deletedPost.id
|
return post.id !== deletedPost.id
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
resetPostList() {
|
resetPostList() {
|
||||||
this.offset = 0
|
this.offset = 0
|
||||||
this.posts = []
|
this.posts = []
|
||||||
this.hasMore = true
|
this.hasMore = true
|
||||||
},
|
},
|
||||||
pinPost(post) {
|
pinPost(post) {
|
||||||
this.$apollo
|
this.$apollo
|
||||||
.mutate({
|
.mutate({
|
||||||
mutation: PostMutations().pinPost,
|
mutation: PostMutations().pinPost,
|
||||||
variables: { id: post.id },
|
variables: { id: post.id },
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$toast.success(this.$t('post.menu.pinnedSuccessfully'))
|
this.$toast.success(this.$t('post.menu.pinnedSuccessfully'))
|
||||||
this.resetPostList()
|
this.resetPostList()
|
||||||
this.$apollo.queries.Post.refetch()
|
this.$apollo.queries.Post.refetch()
|
||||||
})
|
})
|
||||||
.catch(error => this.$toast.error(error.message))
|
.catch(error => this.$toast.error(error.message))
|
||||||
},
|
},
|
||||||
unpinPost(post) {
|
unpinPost(post) {
|
||||||
this.$apollo
|
this.$apollo
|
||||||
.mutate({
|
.mutate({
|
||||||
mutation: PostMutations().unpinPost,
|
mutation: PostMutations().unpinPost,
|
||||||
variables: { id: post.id },
|
variables: { id: post.id },
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$toast.success(this.$t('post.menu.unpinnedSuccessfully'))
|
this.$toast.success(this.$t('post.menu.unpinnedSuccessfully'))
|
||||||
this.resetPostList()
|
this.resetPostList()
|
||||||
this.$apollo.queries.Post.refetch()
|
this.$apollo.queries.Post.refetch()
|
||||||
})
|
})
|
||||||
.catch(error => this.$toast.error(error.message))
|
.catch(error => this.$toast.error(error.message))
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
apollo: {
|
apollo: {
|
||||||
Post: {
|
Post: {
|
||||||
query() {
|
query() {
|
||||||
return filterPosts(this.$i18n)
|
return filterPosts(this.$i18n)
|
||||||
},
|
},
|
||||||
variables() {
|
variables() {
|
||||||
return {
|
return {
|
||||||
filter: this.finalFilters,
|
filter: this.finalFilters,
|
||||||
first: this.pageSize,
|
first: this.pageSize,
|
||||||
orderBy: ['pinned_asc', this.orderBy],
|
orderBy: ['pinned_asc', this.orderBy],
|
||||||
offset: 0,
|
offset: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
update({ Post }) {
|
update({ Post }) {
|
||||||
this.posts = Post
|
this.posts = Post
|
||||||
},
|
},
|
||||||
fetchPolicy: 'cache-and-network',
|
fetchPolicy: 'cache-and-network',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user