diff options
Diffstat (limited to 'src/components/RsvpForm.tsx')
-rw-r--r-- | src/components/RsvpForm.tsx | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/src/components/RsvpForm.tsx b/src/components/RsvpForm.tsx index 9dbc54c..fe6d874 100644 --- a/src/components/RsvpForm.tsx +++ b/src/components/RsvpForm.tsx @@ -1,14 +1,17 @@ import { useState } from 'react'; -import Button from '@mui/material/Button'; -import Paper from '@mui/material/Paper'; -import Grid from '@mui/material/Grid'; -import TextField from '@mui/material/TextField'; -import Typography from '@mui/material/Typography'; -import Radio from '@mui/material/Radio'; -import RadioGroup from '@mui/material/RadioGroup'; -import FormControlLabel from '@mui/material/FormControlLabel'; -import FormControl from '@mui/material/FormControl'; -import FormLabel from '@mui/material/FormLabel'; +import { useSelector } from 'react-redux'; +import { + Button, + FormControl, + FormControlLabel, + FormLabel, + Grid, + Paper, + Radio, + RadioGroup, + TextField, + Typography +} from '@mui/material'; import { useGetGuestsQuery, useUpdateGuestMutation } from '../apiSlice'; @@ -19,20 +22,19 @@ function RsvpForm() { isSuccess, isError, error - } = useGetGuestsQuery() + } = useGetGuestsQuery(); - const [updateGuest] = useUpdateGuestMutation() + const [updateGuest] = useUpdateGuestMutation(); const handleSubmit = (e) => { - e.preventDefault() - console.log('handle') - let guest = guests[0] + e.preventDefault(); + let guest = guests[0]; if (guest.attendance === 'true') { - updateGuest({...guest, attendance: 'false'}) + updateGuest({...guest, attendance: 'false'}); } else { - updateGuest({...guest, attendance: 'true'}) + updateGuest({...guest, attendance: 'true'}); } - } + }; return ( <Paper> @@ -87,23 +89,17 @@ function RsvpForm() { </FormControl> </Grid> <Grid item xs={12} md={4} lg={4}> - <TextField - label="Dietary Restrictions" - variant="outlined" - /> + <TextField label="Dietary Restrictions" variant="outlined" /> </Grid> <Grid item xs={12} md={4} lg={4}> - <TextField - label="Advice" - variant="outlined" - /> + <TextField label="Advice" variant="outlined" /> </Grid> <Grid item> <Button onClick={handleSubmit} variant="contained">Submit</Button> </Grid> </Grid> </Paper> - ) + ); } export default RsvpForm; |