added search error if series not found

This commit is contained in:
stratuma 2024-05-27 17:55:57 +02:00
parent 63941e7ef5
commit d60d630638
2 changed files with 21 additions and 8 deletions

View File

@ -38,7 +38,7 @@ export async function searchCrunchy(q: string) {
if (error.value) {
console.error(error.value)
throw new Error(JSON.stringify(error.value))
return
}
if (proxies && isProxyActive) {
@ -67,7 +67,7 @@ export async function searchCrunchy(q: string) {
if (ferror.value) {
console.error(ferror.value)
throw new Error(JSON.stringify(ferror.value))
return
}
if (fdata.value) {
@ -146,7 +146,7 @@ export async function getCRSeries(q: string) {
if (error.value) {
console.error(error.value)
throw new Error(JSON.stringify(error.value))
return
}
if (!data.value && proxies && isProxyActive) {
@ -167,7 +167,7 @@ export async function getCRSeries(q: string) {
if (ferror.value) {
console.error(ferror.value)
throw new Error(JSON.stringify(ferror.value))
return
}
if (fdata.value) {
@ -228,7 +228,7 @@ export async function getCREpisodeSeriesID(q: string) {
if (error.value) {
console.error(error.value)
throw new Error(JSON.stringify(error.value))
return
}
if (!data.value && proxies && isProxyActive) {
@ -249,7 +249,7 @@ export async function getCREpisodeSeriesID(q: string) {
if (ferror.value) {
console.error(ferror.value)
throw new Error(JSON.stringify(ferror.value))
return
}
data.value = fdata.value

View File

@ -677,7 +677,11 @@ const switchToSeason = async () => {
if (url.value && url.value.includes('crunchyroll') && url.value.includes('/series/') && !CRselectedShow.value) {
const seriesID = url.value.split('/')
CRselectedShow.value = await getCRSeries(seriesID[5])
if (!CRselectedShow.value) return
if (!CRselectedShow.value) {
alert('Series not found')
isFetchingSeasons.value--
return
}
seasons.value = await listSeasonCrunchy(CRselectedShow.value.ID, CRselectedShow.value.Geo)
if (!seasons.value) {
isFetchingSeasons.value--
@ -718,8 +722,17 @@ const switchToSeason = async () => {
if (url.value && url.value.includes('crunchyroll') && url.value.includes('/watch/') && !CRselectedShow.value) {
const episodeID = url.value.split('/')
const seriesID = await getCREpisodeSeriesID(episodeID[5])
if (!seriesID) return
if (!seriesID) {
alert('Episode not found')
isFetchingSeasons.value--
return
}
CRselectedShow.value = await getCRSeries(seriesID)
if (!CRselectedShow.value) {
alert('Series not found')
isFetchingSeasons.value--
return
}
if (!CRselectedShow.value) return
seasons.value = await listSeasonCrunchy(CRselectedShow.value.ID, CRselectedShow.value.Geo)
if (!seasons.value) {