no more error messages on page load

This commit is contained in:
Moriz Wahl 2020-04-14 21:50:53 +02:00
parent 7562af227e
commit 2544edcb29

View File

@ -144,13 +144,13 @@ export default {
return this.hashtagsOffset > 0 return this.hashtagsOffset > 0
}, },
hasMorePosts() { hasMorePosts() {
return (this.postPage + 1) * this.pageSize <= this.postCount return (this.postPage + 1) * this.pageSize < this.postCount
}, },
hasMoreUsers() { hasMoreUsers() {
return (this.userPage + 1) * this.pageSize <= this.userCount return (this.userPage + 1) * this.pageSize < this.userCount
}, },
hasMoreHashtags() { hasMoreHashtags() {
return (this.hashtagPage + 1) * this.pageSize <= this.hashtagCount return (this.hashtagPage + 1) * this.pageSize < this.hashtagCount
}, },
}, },
methods: { methods: {
@ -201,7 +201,7 @@ export default {
update({ searchPosts }) { update({ searchPosts }) {
this.posts = searchPosts.posts this.posts = searchPosts.posts
this.postCount = searchPosts.postCount this.postCount = searchPosts.postCount
if (searchPosts.posts.length) this.activeTab = 'Post' if (this.postCount > 0) this.activeTab = 'Post'
}, },
fetchPolicy: 'cache-and-network', fetchPolicy: 'cache-and-network',
}, },
@ -223,7 +223,7 @@ export default {
update({ searchUsers }) { update({ searchUsers }) {
this.users = searchUsers.users this.users = searchUsers.users
this.userCount = searchUsers.userCount this.userCount = searchUsers.userCount
if (!searchPosts.posts.length && searchUsers.users.length) this.activeTab = 'User' if (this.postCount === 0 && this.userCount > 0) this.activeTab = 'User'
}, },
fetchPolicy: 'cache-and-network', fetchPolicy: 'cache-and-network',
}, },
@ -245,11 +245,7 @@ export default {
update({ searchHashtags }) { update({ searchHashtags }) {
this.hashtags = searchHashtags.hashtags this.hashtags = searchHashtags.hashtags
this.hashtagCount = searchHashtags.hashtagCount this.hashtagCount = searchHashtags.hashtagCount
if ( if (this.postCount === 0 && this.userCount === 0 && this.hashtagCount > 0)
!searchPosts.posts.length &&
!searchUsers.users.length &&
searchHashtags.hashtags.length
)
this.activeTab = 'Hashtag' this.activeTab = 'Hashtag'
}, },
fetchPolicy: 'cache-and-network', fetchPolicy: 'cache-and-network',