Solved issues related to the build

This commit is contained in:
Tiago Ribeiro
2023-10-13 13:53:18 +01:00
parent ca96b37303
commit 348a020e7f
3 changed files with 73 additions and 66 deletions

View File

@@ -21,7 +21,7 @@ export default function UserList({user}: {user: User}) {
const [showDemographicInformation, setShowDemographicInformation] = useState(false);
const {users, reload} = useUsers();
const {groups} = useGroups(user.id);
const {groups} = useGroups(user ? user.id : undefined);
const deleteAccount = (user: User) => {
if (!confirm(`Are you sure you want to delete ${user.name}'s account?`)) return;
@@ -245,7 +245,10 @@ export default function UserList({user}: {user: User}) {
];
const table = useReactTable({
data: user.type === "admin" || user.type === "student" ? users.filter((u) => groups.flatMap((g) => g.participants).includes(u.id)) : users,
data:
user && (user.type === "admin" || user.type === "student")
? users.filter((u) => groups.flatMap((g) => g.participants).includes(u.id))
: users,
columns: (!showDemographicInformation ? defaultColumns : demographicColumns) as any,
getCoreRowModel: getCoreRowModel(),
});