Solved some issues with the Student Dashboard
This commit is contained in:
@@ -42,7 +42,7 @@ export default function StudentDashboard({user}: Props) {
|
||||
const setAssignment = useExamStore((state) => state.setAssignment);
|
||||
|
||||
useEffect(() => {
|
||||
getUserCorporate(user.id).then(setCorporateUserToShow);
|
||||
getUserCorporate("IXdh9EQziAVXXh0jOiC5cPVlgS82").then(setCorporateUserToShow);
|
||||
}, [user]);
|
||||
|
||||
const startAssignment = (assignment: Assignment) => {
|
||||
@@ -70,7 +70,7 @@ export default function StudentDashboard({user}: Props) {
|
||||
<>
|
||||
{corporateUserToShow && (
|
||||
<div className="absolute top-4 right-4 bg-neutral-200 px-2 rounded-lg py-1">
|
||||
Linked to: <b>{corporateUserToShow?.corporateInformation.companyInformation.name || corporateUserToShow.name}</b>
|
||||
Linked to: <b>{corporateUserToShow?.corporateInformation?.companyInformation.name || corporateUserToShow.name}</b>
|
||||
</div>
|
||||
)}
|
||||
<ProfileSummary
|
||||
|
||||
@@ -244,7 +244,7 @@ export default function TeacherDashboard({user}: Props) {
|
||||
<>
|
||||
{corporateUserToShow && (
|
||||
<div className="absolute top-4 right-4 bg-neutral-200 px-2 rounded-lg py-1">
|
||||
Linked to: <b>{corporateUserToShow?.corporateInformation.companyInformation.name || corporateUserToShow.name}</b>
|
||||
Linked to: <b>{corporateUserToShow?.corporateInformation?.companyInformation.name || corporateUserToShow.name}</b>
|
||||
</div>
|
||||
)}
|
||||
<section
|
||||
|
||||
@@ -65,7 +65,7 @@ export default function BatchCodeGenerator({user}: {user: User}) {
|
||||
return EMAIL_REGEX.test(email) && !users.map((u) => u.email).includes(email)
|
||||
? {
|
||||
email: email.toString(),
|
||||
name: `${firstName} ${lastName}`,
|
||||
name: `${firstName ?? ""} ${lastName ?? ""}`.trim(),
|
||||
passport_id: passport_id.toString(),
|
||||
}
|
||||
: undefined;
|
||||
|
||||
@@ -14,5 +14,5 @@ export const getUserCorporate = async (userID: string) => {
|
||||
const users = (await axios.get<User[]>("/api/users/list")).data;
|
||||
|
||||
const admins = groups.map((g) => users.find((u) => u.id === g.admin));
|
||||
return admins.map((x) => x?.type).includes("corporate") ? (admins[0] as CorporateUser) : undefined;
|
||||
return admins.filter((x) => x?.type === "admin") ? (admins[0] as CorporateUser) : undefined;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user