diff --git a/resources/assets/js/components/DiscoverComponent.vue b/resources/assets/js/components/DiscoverComponent.vue index deb29d873..04182c37d 100644 --- a/resources/assets/js/components/DiscoverComponent.vue +++ b/resources/assets/js/components/DiscoverComponent.vue @@ -16,10 +16,7 @@

{{profile.username}}

{{profile.name}}

-
- - -
+ @@ -36,16 +33,6 @@
-
-
- - {{post.likes_count}} - - - {{post.comments_count}} - -
-
@@ -53,7 +40,7 @@
-

To view more posts, check the home, local or federated timelines.

+

To view more posts, check the home or local timelines.

@@ -68,10 +55,26 @@ export default { } }, mounted() { - this.fetchData(); + this.slowTimeout(); + this.fetchData(); }, methods: { + followUser(id, event) { + axios.post('/i/follow', { + item: id + }).then(res => { + let el = $(event.target); + el.addClass('btn-outline-secondary').removeClass('btn-primary'); + el.text('Unfollow'); + }).catch(err => { + swal( + 'Whoops! Something went wrong...', + 'An error occured, please try again later.', + 'error' + ); + }); + }, fetchData() { axios.get('/api/v2/discover') .then((res) => { @@ -80,16 +83,23 @@ export default { this.posts = data.posts; if(this.people.length > 1) { - $('.section-people .lds-ring').hide(); + $('.section-people .loader').hide(); $('.section-people .row.d-none').removeClass('d-none'); } if(this.posts.length > 1) { - $('.section-explore .lds-ring').hide(); + $('.section-explore .loader').hide(); $('.section-explore .row.d-none').removeClass('d-none'); } }); - } + }, + slowTimeout() { + setTimeout(function() { + let el = $('

').addClass('font-weight-bold').text('This is taking longer than expected to load. Please try reloading the page if this does not load after 30 seconds.'); + $('.section-people .loader').append(el); + $('.section-explore .loader').append(el); + }, 5000); + } } } \ No newline at end of file