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 class="flex justify-center">
<div class="flex justify-center">
<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>
<button
@@ -140,17 +146,19 @@ export default {
methods: {
fetchNewArticles() {
this.loading = true;
axios
.get(
`/api/source/${this.source.slug}?page=${this.current_page +
1}`
)
.then(response => {
this.current_page = response.data.articles.current_page;
// spread the array item into individual arguments
this.articles.push(...response.data.articles.data);
this.loading = false;
});
sleep(2000).then(() => {
axios
.get(
`/api/source/${this.source.slug}?page=${this
.current_page + 1}`
)
.then(response => {
this.current_page = response.data.articles.current_page;
// spread the array item into individual arguments
this.articles.push(...response.data.articles.data);
this.loading = false;
});
});
}
}
};