diff options
author | Michael Hunteman <michael@huntm.net> | 2024-06-23 13:55:42 -0700 |
---|---|---|
committer | Michael Hunteman <michael@huntm.net> | 2024-06-23 13:55:42 -0700 |
commit | 07752babb4e692452e1cd7f2133c4d8dde1b3b1c (patch) | |
tree | b3be7698f1af43f83bccd3bbbf6e19cd03532f1b /client/src/components | |
parent | 4bf5d1a620dfe96ea9593d44cfcd0f142fcdec61 (diff) |
Authenticate UI users
Diffstat (limited to 'client/src/components')
-rw-r--r-- | client/src/components/Rsvp.tsx | 2 | ||||
-rw-r--r-- | client/src/components/RsvpForm.tsx | 17 |
2 files changed, 3 insertions, 16 deletions
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() { <Outlet context={auth?.guest} /> </> ) : ( - <Navigate to="/guest-login" state={{ from: location }} replace /> + <Navigate to="/guests/login" state={{ from: location }} replace /> ); } 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<FormValues>({ + } = useForm<Guest>({ 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' }, |