From 5e5560b558ff818546c94135bebf334be770c920 Mon Sep 17 00:00:00 2001 From: Michael Hunteman Date: Sat, 9 Mar 2024 15:13:45 -0800 Subject: Add carousel --- src/features/auth/GuestLogin.tsx | 50 ++++++++++++++++++++++------------------ src/features/auth/authSlice.ts | 10 ++++---- 2 files changed, 32 insertions(+), 28 deletions(-) (limited to 'src/features') 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({ + const { + register, + handleSubmit, + formState: { errors }, + } = useForm({ 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 ( - +
- - Guest Login - + Guest Login -
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; -- cgit v1.2.3