summaryrefslogtreecommitdiff
path: root/client/src/components/RsvpForm.tsx
diff options
context:
space:
mode:
authorMichael Hunteman <michael@huntm.net>2024-06-23 13:55:42 -0700
committerMichael Hunteman <michael@huntm.net>2024-06-23 13:55:42 -0700
commit07752babb4e692452e1cd7f2133c4d8dde1b3b1c (patch)
treeb3be7698f1af43f83bccd3bbbf6e19cd03532f1b /client/src/components/RsvpForm.tsx
parent4bf5d1a620dfe96ea9593d44cfcd0f142fcdec61 (diff)
Authenticate UI users
Diffstat (limited to 'client/src/components/RsvpForm.tsx')
-rw-r--r--client/src/components/RsvpForm.tsx17
1 files changed, 2 insertions, 15 deletions
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' },