Update SourceView.vue

This commit is contained in:
2020-08-22 02:30:26 +05:00
parent de2c54b9c0
commit 0d123135d2

View File

@@ -74,11 +74,17 @@
</div> </div>
</div> </div>
</div> </div>
<div class="flex justify-center">
<div class="flex justify-center">
<div v-show="loading"> <div v-show="loading">
<lottie-player src="https://assets9.lottiefiles.com/private_files/lf30_bIUWq7.json" background="transparent" speed="3" style="width: 100px; height: 100px;" loop autoplay></lottie-player> <lottie-player
src="https://assets9.lottiefiles.com/private_files/lf30_bIUWq7.json"
background="transparent"
speed="3"
style="width: 100px; height: 100px;"
loop
autoplay
></lottie-player>
</div> </div>
<button <button
@@ -140,17 +146,19 @@ export default {
methods: { methods: {
fetchNewArticles() { fetchNewArticles() {
this.loading = true; this.loading = true;
axios sleep(2000).then(() => {
.get( axios
`/api/source/${this.source.slug}?page=${this.current_page + .get(
1}` `/api/source/${this.source.slug}?page=${this
) .current_page + 1}`
.then(response => { )
this.current_page = response.data.articles.current_page; .then(response => {
// spread the array item into individual arguments this.current_page = response.data.articles.current_page;
this.articles.push(...response.data.articles.data); // spread the array item into individual arguments
this.loading = false; this.articles.push(...response.data.articles.data);
}); this.loading = false;
});
});
} }
} }
}; };