Skip to content

Commit

Permalink
former subteam existence check
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarwang20 committed Sep 25, 2023
1 parent 0672b09 commit 079baed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frontend/src/components/Admin/AddUser/AddUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export default function AddUser(): JSX.Element {
const errors = json
.map((m) => {
const [email, role, subteam] = [m.email, m.role, m.subteam];
const formerSubteams: string[] = m.formerSubteams.split(', ');
const formerSubteams: string[] = m.formerSubteams ? m.formerSubteams.split(', ') : [];
const err = [];
if (!email) {
err.push('missing email');
Expand All @@ -227,9 +227,11 @@ export default function AddUser(): JSX.Element {
err.push('invalid subteam');
}
if (formerSubteams.some((t) => !validSubteams.includes(t))) {
console.log(formerSubteams);

Check warning on line 230 in frontend/src/components/Admin/AddUser/AddUser.tsx

View workflow job for this annotation

GitHub Actions / check

Unexpected console statement
err.push('invalid former subteam');
}
if (formerSubteams.includes(subteam)) {
console.log(formerSubteams);

Check warning on line 234 in frontend/src/components/Admin/AddUser/AddUser.tsx

View workflow job for this annotation

GitHub Actions / check

Unexpected console statement
err.push('subteam cannot be in former subteams');
}
return err.length > 0 ? `Row ${json.indexOf(m) + 1}: ${err.join(', ')}` : '';
Expand Down

0 comments on commit 079baed

Please sign in to comment.