fix(ui): Only show loading icon on initial load and on page change

This commit is contained in:
TwiN 2023-07-08 17:36:12 -04:00
parent 11eb7fb02e
commit 9142ff837c
2 changed files with 3 additions and 2 deletions

View File

@ -32,7 +32,6 @@ export default {
emits: ['showTooltip', 'toggleShowAverageResponseTime'], emits: ['showTooltip', 'toggleShowAverageResponseTime'],
methods: { methods: {
fetchData() { fetchData() {
this.retrievedData = false;
fetch(`${SERVER_URL}/api/v1/endpoints/statuses?page=${this.currentPage}`, {credentials: 'include'}) fetch(`${SERVER_URL}/api/v1/endpoints/statuses?page=${this.currentPage}`, {credentials: 'include'})
.then(response => { .then(response => {
this.retrievedData = true; this.retrievedData = true;
@ -50,6 +49,7 @@ export default {
}); });
}, },
changePage(page) { changePage(page) {
this.retrievedData = false; // Show loading only on page change or on initial load
this.currentPage = page; this.currentPage = page;
this.fetchData(); this.fetchData();
}, },
@ -69,6 +69,7 @@ export default {
} }
}, },
created() { created() {
this.retrievedData = false; // Show loading only on page change or on initial load
this.fetchData(); this.fetchData();
} }
} }

File diff suppressed because one or more lines are too long