Skip to content

Commit

Permalink
Fix: identification form required validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Akalanka47000 committed Oct 14, 2023
1 parent 3420a70 commit 5cd536a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/identification-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ const IdentificationForm = () => {
const handleSubmit = async (e) => {
e.preventDefault();
if (
formData.find(({ nic, meal_preference, gender }, index) => !nic || !idFiles[index] || !meal_preference || !gender)
formData.find(
({ nic, meal_preference, gender, student_id_url }, index) =>
!nic || (!idFiles[index] && !student_id_url) || !meal_preference || !gender
)
) {
return toast({ variant: "destructive", title: "Please make sure that all required fields are filled" });
}
Expand Down

0 comments on commit 5cd536a

Please sign in to comment.