Skip to content

Commit

Permalink
feat: Add id to doctors
Browse files Browse the repository at this point in the history
  • Loading branch information
RudraPatel2003 committed Oct 24, 2024
1 parent f57bb21 commit ac58e0f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/app/form/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ export default function Form() {

const searchParams = useSearchParams();

console.log(errors);

useEffect(() => {
const error = searchParams.get("error");
if (error) {
Expand All @@ -109,7 +111,6 @@ export default function Form() {
}, [searchParams, setError]);

const onSubmit = async (data: GeneralInformationFormValues) => {
setError("root", { message: "" });
// eslint-disable-next-line no-console
console.log(data);
};
Expand Down Expand Up @@ -452,7 +453,7 @@ export default function Form() {
render={({ field }) => (
<RadioGroup
{...field}
value={field.value ? String(field.value) : ""}
value={field.value !== undefined ? String(field.value) : ""}
onChange={(e) => field.onChange(e.target.value === "true")}
>
<FormControlLabel
Expand Down Expand Up @@ -912,7 +913,13 @@ export default function Form() {
</Box>
))}
<Button
onClick={() => addDoctor({ name: "", phone: "" } as Doctor)}
onClick={() =>
addDoctor({
id: crypto.randomUUID(),
name: "",
phone: "",
} as Doctor)
}
variant="outlined"
color="primary"
startIcon={<AddIcon />}
Expand Down
2 changes: 1 addition & 1 deletion src/types/EnrollmentForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const DoctorSchema = z.object({
"Invalid phone number",
)
.transform((val) => parsePhoneNumber(val, "US").number.toString()),
id: z.number(),
id: z.string(),
});

export const generalInformationValidator = z
Expand Down

0 comments on commit ac58e0f

Please sign in to comment.