fix: error when no titre or article
This commit is contained in:
+2
-6
@@ -49,16 +49,12 @@ async function getData() {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
if (titres.length === 0 || articles.length === 0) {
|
|
||||||
throw new Error('No data')
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
titres,
|
titres,
|
||||||
articles
|
articles
|
||||||
}
|
}
|
||||||
} catch {
|
} catch (error) {
|
||||||
throw new Error('Failed to fetch data')
|
throw new Error(error.cause)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user