Fixes #4 [Classroom] Fix error when a person has only 1 name

This commit is contained in:
Araozu 2023-10-06 10:32:04 -05:00
parent 595e2debea
commit b72026a93f

View File

@ -31,7 +31,7 @@ export function ClassroomUserCreation(props: {
const paternalSurname = props.person.person_paternal_surname;
const maternalSurname = props.person.person_maternal_surname;
const user = `${firstName[0]}${secondName[0] ?? ""}${paternalSurname}${maternalSurname[0]}`;
const user = `${firstName[0]}${secondName?.[0] ?? ""}${paternalSurname}${maternalSurname[0]}`;
const next_date = new Date();
next_date.setDate(next_date.getDate() + 60);
@ -64,7 +64,7 @@ export function ClassroomUserCreation(props: {
);
} else {
console.error(response.data);
setError(response.data.Err.reason);
setError(response.data.Error.reason);
setStatus(LoadingStatus.Error);
}
})