diff options
author | Michael Hunteman <michael@huntm.net> | 2024-03-09 15:13:45 -0800 |
---|---|---|
committer | Michael Hunteman <michael@huntm.net> | 2024-03-09 15:13:45 -0800 |
commit | 5e5560b558ff818546c94135bebf334be770c920 (patch) | |
tree | 23098a45caa1c9153a3387721151d1901aebf390 /src/features | |
parent | a9333dc90f56ae4e19fabff4822ac1ffba7c6205 (diff) |
Add carousel
Diffstat (limited to 'src/features')
-rw-r--r-- | src/features/auth/GuestLogin.tsx | 50 | ||||
-rw-r--r-- | src/features/auth/authSlice.ts | 10 |
2 files changed, 32 insertions, 28 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> diff --git a/src/features/auth/authSlice.ts b/src/features/auth/authSlice.ts index d5b294c..34ede58 100644 --- a/src/features/auth/authSlice.ts +++ b/src/features/auth/authSlice.ts @@ -3,9 +3,9 @@ import type { RootState } from '../../store'; import { Guest } from '../../apiSlice'; type AuthState = { - guest: Guest | null - token: string | null -} + guest: Guest | null; + token: string | null; +}; const authSlice = createSlice({ name: 'auth', @@ -15,8 +15,8 @@ const authSlice = createSlice({ const { guest, token } = action.payload; state.guest = guest; state.token = token; - } - } + }, + }, }); export const { setCredentials } = authSlice.actions; |