From 07752babb4e692452e1cd7f2133c4d8dde1b3b1c Mon Sep 17 00:00:00 2001 From: Michael Hunteman Date: Sun, 23 Jun 2024 13:55:42 -0700 Subject: Authenticate UI users --- client/src/components/Rsvp.tsx | 2 +- client/src/components/RsvpForm.tsx | 17 ++--------------- 2 files changed, 3 insertions(+), 16 deletions(-) (limited to 'client/src/components') diff --git a/client/src/components/Rsvp.tsx b/client/src/components/Rsvp.tsx index dad7213..fbcaf4a 100644 --- a/client/src/components/Rsvp.tsx +++ b/client/src/components/Rsvp.tsx @@ -22,7 +22,7 @@ function Rsvp() { ) : ( - + ); } diff --git a/client/src/components/RsvpForm.tsx b/client/src/components/RsvpForm.tsx index 71db0d8..9ac2d53 100644 --- a/client/src/components/RsvpForm.tsx +++ b/client/src/components/RsvpForm.tsx @@ -16,20 +16,6 @@ import { useForm, Controller, useFieldArray } from 'react-hook-form'; import { useUpdateGuestMutation } from '../apiSlice'; import type { Guest } from '../apiSlice'; -type FormValues = { - id: number; - firstName: string; - lastName: string; - attendance: string; - email: string; - partySize: number; - message: string; - partyList: { - firstName: string; - lastName: string; - }[]; -}; - function RsvpForm() { const [updateGuest] = useUpdateGuestMutation(); const guest: Guest = useOutletContext(); @@ -41,7 +27,7 @@ function RsvpForm() { control, watch, formState: { errors }, - } = useForm({ + } = useForm({ defaultValues: { id: guest?.id, firstName: guest?.firstName, @@ -163,6 +149,7 @@ function RsvpForm() { helperText={errors.partySize?.message} required {...register('partySize', { + valueAsNumber: true, onChange: handleParty, required: 'This field is required', min: { value: 1, message: 'Please enter a positive integer' }, -- cgit v1.2.3