File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ const useAuth = () => {
58
58
user,
59
59
isLoading,
60
60
error,
61
+ resetError : ( ) => setError ( null ) ,
61
62
}
62
63
}
63
64
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ export const Route = createFileRoute("/login")({
38
38
39
39
function Login ( ) {
40
40
const [ show , setShow ] = useBoolean ( )
41
- const { loginMutation, error } = useAuth ( )
41
+ const { loginMutation, error, resetError } = useAuth ( )
42
42
const {
43
43
register,
44
44
handleSubmit,
@@ -53,7 +53,15 @@ function Login() {
53
53
} )
54
54
55
55
const onSubmit : SubmitHandler < AccessToken > = async ( data ) => {
56
- loginMutation . mutate ( data )
56
+ if ( isSubmitting ) return
57
+
58
+ resetError ( )
59
+
60
+ try {
61
+ await loginMutation . mutateAsync ( data )
62
+ } catch {
63
+ // error is handled by useAuth hook
64
+ }
57
65
}
58
66
59
67
return (
You can’t perform that action at this time.
0 commit comments