Solved another stupid bug
This commit is contained in:
@@ -13,6 +13,6 @@ export const getUserCorporate = async (userID: string) => {
|
|||||||
const groups = (await axios.get<Group[]>(`/api/groups?participant=${userID}`)).data;
|
const groups = (await axios.get<Group[]>(`/api/groups?participant=${userID}`)).data;
|
||||||
const users = (await axios.get<User[]>("/api/users/list")).data;
|
const users = (await axios.get<User[]>("/api/users/list")).data;
|
||||||
|
|
||||||
const admins = groups.map((g) => users.find((u) => u.id === g.admin));
|
const admins = groups.map((g) => users.find((u) => u.id === g.admin)).filter((x) => x?.type === "corporate");
|
||||||
return admins.filter((x) => x?.type === "admin") ? (admins[0] as CorporateUser) : undefined;
|
return admins.length > 0 ? (admins[0] as CorporateUser) : undefined;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user