Add message on no result
This commit is contained in:
parent
ed3ab8b4d2
commit
5abb89c39e
1 changed files with 11 additions and 4 deletions
|
@ -115,10 +115,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div v-if="error" class="alert alert-danger">
|
||||||
<div v-if="error" id="instances-list-error" class="alert alert-danger">
|
Sorry, but we cannot fetch the instances list. Please retry later.
|
||||||
Sorry, but we cannot fetch the instances list. Please retry later.
|
</div>
|
||||||
</div>
|
|
||||||
|
<div v-if="noResults" class="alert alert-info">
|
||||||
|
Sorry, but we did not find any instance matching your filters.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -252,6 +254,7 @@
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
error: false,
|
error: false,
|
||||||
|
noResults: false,
|
||||||
|
|
||||||
instances: [],
|
instances: [],
|
||||||
translatedThemes: {
|
translatedThemes: {
|
||||||
|
@ -373,6 +376,8 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchInstances () {
|
fetchInstances () {
|
||||||
|
this.noResults = false
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
start: 0,
|
start: 0,
|
||||||
count: 250,
|
count: 250,
|
||||||
|
@ -394,6 +399,8 @@
|
||||||
axios('https://instances.joinpeertube.org/api/v1/instances', options)
|
axios('https://instances.joinpeertube.org/api/v1/instances', options)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.instances = this.shuffle(response.data.data)
|
this.instances = this.shuffle(response.data.data)
|
||||||
|
|
||||||
|
if (this.instances.length === 0) this.noResults = true
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
|
Loading…
Reference in a new issue