More stuff related to the groups
This commit is contained in:
@@ -36,22 +36,13 @@ async function get(req: NextApiRequest, res: NextApiResponse) {
|
||||
|
||||
if (corporatesFromMaster.length === 0) return res.status(200).json(masterCorporateGroups);
|
||||
|
||||
Promise.all(corporatesFromMaster.map((c) => getGroupsForUser(c, participant)))
|
||||
.then((groups) => {
|
||||
res.status(200).json([...masterCorporateGroups, ...uniqBy(groups.flat(), "id")]);
|
||||
return;
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
res.status(500).json({ok: false});
|
||||
return;
|
||||
});
|
||||
const groups = await Promise.all(corporatesFromMaster.map((c) => getGroupsForUser(c, participant)));
|
||||
return res.status(200).json([...masterCorporateGroups, ...uniqBy(groups.flat(), "id")]);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
res.status(500).json({ok: false});
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user