summaryrefslogtreecommitdiff
path: root/src/features/auth/GuestLogin.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/features/auth/GuestLogin.tsx')
-rw-r--r--src/features/auth/GuestLogin.tsx24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/features/auth/GuestLogin.tsx b/src/features/auth/GuestLogin.tsx
index 1f228d8..cbab494 100644
--- a/src/features/auth/GuestLogin.tsx
+++ b/src/features/auth/GuestLogin.tsx
@@ -10,8 +10,7 @@ function GuestLogin() {
const navigate = useNavigate();
const [login] = useLoginMutation();
- const { register, handleSubmit,
- formState: { isDirty, isValid } } = useForm<LoginRequest>({
+ const { register, handleSubmit, formState: { errors } } = useForm<LoginRequest>({
defaultValues: {
firstName: '',
lastName: ''
@@ -29,7 +28,12 @@ function GuestLogin() {
return (
<Container component="form" maxWidth="xs" onSubmit={handleSubmit(onSubmit)}>
- <Box sx={{ mt: 8, display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
+ <Box
+ sx={{ mt: 8,
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "center" }}
+ >
<Typography variant="h6">
Guest Login
</Typography>
@@ -38,24 +42,26 @@ function GuestLogin() {
variant="outlined"
margin="normal"
fullWidth
- required
- {...register("firstName", { required: true })}
+ error={!!errors.firstName}
+ helperText={errors.firstName?.message}
+ {...register("firstName", { required: "Please enter your first name" })}
/>
<TextField
label="Last Name"
variant="outlined"
margin="normal"
fullWidth
- required
- {...register("lastName", { required: true })}
+ error={!!errors.lastName}
+ helperText={errors.lastName?.message}
+ {...register("lastName", { required: "Please enter your last name" })}
/>
<Button
type="submit"
variant="contained"
fullWidth
sx={{ mt: 2 }}
- disabled={!isDirty || !isValid}>
- Login
+ >
+ Log in
</Button>
</Box>
</Container>