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 = () => {
5858 user,
5959 isLoading,
6060 error,
61+ resetError : ( ) => setError ( null ) ,
6162 }
6263}
6364
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ export const Route = createFileRoute("/login")({
3838
3939function Login ( ) {
4040 const [ show , setShow ] = useBoolean ( )
41- const { loginMutation, error } = useAuth ( )
41+ const { loginMutation, error, resetError } = useAuth ( )
4242 const {
4343 register,
4444 handleSubmit,
@@ -53,7 +53,15 @@ function Login() {
5353 } )
5454
5555 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+ }
5765 }
5866
5967 return (
You can’t perform that action at this time.
0 commit comments