diff --git a/components/Header.vue b/components/Header.vue index 93b295c..4a37d67 100644 --- a/components/Header.vue +++ b/components/Header.vue @@ -44,8 +44,10 @@ useAsyncData(async () => { }) const results = ref([]) +const episodeResults = ref([]) const visible = ref(false) const thumbs = ref({}) + async function search (d) { const term = d.target.value if (term.length > 1) { @@ -57,16 +59,28 @@ async function search (d) { ofst: 0 }) })).json() - if (res.data.length === 0) { + if (res.data.topics.length === 0) { results.value = [{ error: 'No Results Found' }] } else { - for (let i = 0; i < res.data.length; i++) { - thumbs.value[res.data[i].id] = sb.storage.from('thumbs').getPublicUrl(res.data[i].id + '.jpeg').data.publicUrl + for (let i = 0; i < res.data.topics.length; i++) { + thumbs.value[res.data.topics[i].id] = sb.storage.from('thumbs').getPublicUrl(res.data.topics[i].id + '.jpeg').data.publicUrl } - results.value = res.data + results.value = res.data.topics + } + + if (res.data.episodes.length === 0) { + episodeResults.value = [{ + error: 'No Results Found' + }] + } else { + for (let i = 0; i < res.data.topics.length; i++) { + thumbs.value[res.data.episodes[i].id] = sb.storage.from('thumbs').getPublicUrl(res.data.episodes[i].id + '.jpeg').data.publicUrl + } + + episodeResults.value = res.data.episodes } visible.value = results.value.length > 0 @@ -147,6 +161,7 @@ function logout () { opacity: visible ? '0.95' : '0' }" > +