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 {
|
||||
titres,
|
||||
articles
|
||||
}
|
||||
} catch {
|
||||
throw new Error('Failed to fetch data')
|
||||
} catch (error) {
|
||||
throw new Error(error.cause)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user