Include no results when a search query returns undefined
This commit is contained in:
parent
1f2b0a9a36
commit
01d3cbbaa5
1 changed files with 7 additions and 3 deletions
|
@ -7,6 +7,10 @@
|
||||||
<mediaitem-square :item="getTopResult()"></mediaitem-square>
|
<mediaitem-square :item="getTopResult()"></mediaitem-square>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else style="text-align: center">
|
||||||
|
<h3>No Results</h3>
|
||||||
|
<p>Try a new search.</p>
|
||||||
|
</div>
|
||||||
<div class="col" v-if="search.results.song">
|
<div class="col" v-if="search.results.song">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
@ -91,10 +95,10 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getTopResult() {
|
getTopResult() {
|
||||||
if (this.search.results["meta"]) {
|
try {
|
||||||
return this.search.results[this.search.results.meta.results.order[0]]["data"][0]
|
return this.search.results[this.search.results.meta.results.order[0]]["data"][0]
|
||||||
} else {
|
} catch( error ) {
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue