diff options
Diffstat (limited to 'src/features/auth/GuestLogin.tsx')
-rw-r--r-- | src/features/auth/GuestLogin.tsx | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/src/features/auth/GuestLogin.tsx b/src/features/auth/GuestLogin.tsx index 11f3d5b..94bad05 100644 --- a/src/features/auth/GuestLogin.tsx +++ b/src/features/auth/GuestLogin.tsx @@ -10,33 +10,42 @@ function GuestLogin() { const navigate = useNavigate(); const [login] = useLoginMutation(); - const { register, handleSubmit, formState: { errors } } = useForm<LoginRequest>({ + const { + register, + handleSubmit, + formState: { errors }, + } = useForm<LoginRequest>({ defaultValues: { firstName: '', - lastName: '' - } + lastName: '', + }, }); const onSubmit = async (data: LoginRequest) => { - try { - dispatch(setCredentials(await login(data).unwrap())); - navigate('/rsvp'); - } catch (e) { - console.log(e); - } + try { + dispatch(setCredentials(await login(data).unwrap())); + navigate('/rsvp'); + } catch (e) { + console.log(e); + } }; return ( - <Container component="form" maxWidth="xs" noValidate onSubmit={handleSubmit(onSubmit)}> + <Container + component="form" + maxWidth="xs" + noValidate + onSubmit={handleSubmit(onSubmit)} + > <div - style={{ marginTop: 80, - display: 'flex', - flexDirection: 'column', - alignItems: 'center' }} + style={{ + marginTop: 80, + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + }} > - <Typography variant="h6"> - Guest Login - </Typography> + <Typography variant="h6">Guest Login</Typography> <TextField label="First Name" variant="outlined" @@ -57,12 +66,7 @@ function GuestLogin() { required {...register('lastName', { required: 'This field is required' })} /> - <Button - type="submit" - variant="contained" - fullWidth - sx={{ mt: 2 }} - > + <Button type="submit" variant="contained" fullWidth sx={{ mt: 2 }}> Log in </Button> </div> |