mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 18:52:06 +00:00
Updated login form to disable the form when submitting
This commit is contained in:
@@ -11,6 +11,7 @@ import FormInfo from '../ui/forms/FormInfo';
|
|||||||
import FormLabel from '../ui/forms/FormLabel';
|
import FormLabel from '../ui/forms/FormLabel';
|
||||||
import FormSegment from '../ui/forms/FormSegment';
|
import FormSegment from '../ui/forms/FormSegment';
|
||||||
import FormTextInput from '../ui/forms/FormTextInput';
|
import FormTextInput from '../ui/forms/FormTextInput';
|
||||||
|
import Button from '../ui/forms/Button';
|
||||||
|
|
||||||
type LoginT = z.infer<typeof LoginValidationSchema>;
|
type LoginT = z.infer<typeof LoginValidationSchema>;
|
||||||
const LoginForm = () => {
|
const LoginForm = () => {
|
||||||
@@ -51,6 +52,7 @@ const LoginForm = () => {
|
|||||||
id="username"
|
id="username"
|
||||||
type="text"
|
type="text"
|
||||||
formValidationSchema={register('username')}
|
formValidationSchema={register('username')}
|
||||||
|
disabled={formState.isSubmitting}
|
||||||
error={!!errors.username}
|
error={!!errors.username}
|
||||||
placeholder="username"
|
placeholder="username"
|
||||||
/>
|
/>
|
||||||
@@ -62,6 +64,7 @@ const LoginForm = () => {
|
|||||||
</FormInfo>
|
</FormInfo>
|
||||||
<FormSegment>
|
<FormSegment>
|
||||||
<FormTextInput
|
<FormTextInput
|
||||||
|
disabled={formState.isSubmitting}
|
||||||
id="password"
|
id="password"
|
||||||
type="password"
|
type="password"
|
||||||
formValidationSchema={register('password')}
|
formValidationSchema={register('password')}
|
||||||
@@ -73,9 +76,9 @@ const LoginForm = () => {
|
|||||||
|
|
||||||
{responseError && <ErrorAlert error={responseError} setError={setResponseError} />}
|
{responseError && <ErrorAlert error={responseError} setError={setResponseError} />}
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<button type="submit" className="btn-primary btn w-full">
|
<Button type="submit" isSubmitting={formState.isSubmitting}>
|
||||||
Login
|
Login
|
||||||
</button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user