Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiguangyao
mr-julyedu
Commits
b465ec56
Commit
b465ec56
authored
Aug 08, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
formik onSubmissionError
parent
61b18f8c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
src/components/passport/common/OnSubmissionError/index.js
+10
-5
src/components/passport/forgotPassword/index.js
+2
-2
No files found.
src/components/passport/common/
Effect
/index.js
→
src/components/passport/common/
OnSubmissionError
/index.js
View file @
b465ec56
import
{
useEffect
}
from
'react'
import
{
useEffect
}
from
'react'
import
{
connect
}
from
"formik"
;
const
OnSubmissionError
=
props
=>
{
const
{
callback
,
formik
}
=
props
export
default
function
Effect
(
props
)
{
const
{
submitCount
,
isValid
}
=
props
.
formik
const
effect
=
()
=>
{
const
effect
=
()
=>
{
if
(
submitCount
>
0
&&
!
isValid
){
if
(
formik
.
submitCount
>
0
&&
!
formik
.
isValid
&&
!
formik
.
isSubmitting
){
props
.
onSubmissionError
(
)
callback
(
formik
)
}
}
}
}
useEffect
(
effect
,
[
submitCount
])
useEffect
(
effect
,
[
formik
.
submitCount
,
formik
.
isSubmitting
])
return
null
return
null
}
}
export
default
connect
(
OnSubmissionError
)
\ No newline at end of file
src/components/passport/forgotPassword/index.js
View file @
b465ec56
...
@@ -9,7 +9,7 @@ import { Toast } from "antd-mobile";
...
@@ -9,7 +9,7 @@ import { Toast } from "antd-mobile";
import
{
HeaderBar
,
Captcha
,
ClearableInput
}
from
"@/common"
;
import
{
HeaderBar
,
Captcha
,
ClearableInput
}
from
"@/common"
;
import
{
validateTel
,
validateEmail
,
http
,
api
}
from
"@/utils"
;
import
{
validateTel
,
validateEmail
,
http
,
api
}
from
"@/utils"
;
import
{
quickLogin
}
from
'@/store/userAction'
;
import
{
quickLogin
}
from
'@/store/userAction'
;
import
Effect
from
'../common/Effect
'
import
OnSubmissionError
from
'../common/OnSubmissionError
'
class
ForgotPassword
extends
Component
{
class
ForgotPassword
extends
Component
{
...
@@ -85,7 +85,7 @@ class ForgotPassword extends Component {
...
@@ -85,7 +85,7 @@ class ForgotPassword extends Component {
}}
}}
/
>
/
>
}
}
<
Effect
formik
=
{
this
.
props
}
onSubmissionError
=
{
this
.
onSubmissionError
}
/
>
<
OnSubmissionError
callback
=
{
this
.
onSubmissionError
}
/
>
<
Captcha
getInstance
=
{
this
.
getCaptchaInstance
}
onVerify
=
{
this
.
onVerify
}
/
>
<
Captcha
getInstance
=
{
this
.
getCaptchaInstance
}
onVerify
=
{
this
.
onVerify
}
/
>
<
Button
active
=
{
isValid
}
>
下一步
<
/Button
>
<
Button
active
=
{
isValid
}
>
下一步
<
/Button
>
<
/Form
>
<
/Form
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment