@@ -124,9 +124,14 @@ export async function createRouter<
|
||||
}
|
||||
});
|
||||
const results = await Promise.all(tasks);
|
||||
if (errors.length > 0) {
|
||||
const noResults =
|
||||
results.length === 0 || results.flatMap(r => r.results).length === 0;
|
||||
if (errors.length > 0 && noResults) {
|
||||
return res.status(500).send({ errors, results });
|
||||
}
|
||||
if (errors.length > 0) {
|
||||
return res.json({ errors, results });
|
||||
}
|
||||
return res.json(results);
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user