尽管承诺已解决,但为什么会调用 catch 案例?
Why is the catch case called although the promise is resolved?
谁能帮我理解为什么之前的 promise 已成功解决但 .catch 案例仍被调用?
https://gist.github.com/defrian/fd6dd7f072754e833b60c7bd6ed45159
当密码正确时我收到(为什么它包含“有效负载”:“登录错误”?)
Array [
Object {
"type": "login_user",
},
Object {
"payload": Object {
"name": "signedUser",
},
"type": "login_user_success",
},
Object {
"payload": "Cannot read property 'dispatch' of undefined",
"type": "login_user_fail",
},
]
当我使用错误的密码时,我收到了(如我所料)
Array [
Object {
"type": "login_user",
},
Object {
"payload": "signIn error ",
"type": "login_user_fail",
},
]
我发现了错误。这是由 NavigationService 调用引起的。
当我使用 redux-thunk 时,我不得不将其更改为 dispatch(() => NavigationService.navigate('Home'));
谁能帮我理解为什么之前的 promise 已成功解决但 .catch 案例仍被调用? https://gist.github.com/defrian/fd6dd7f072754e833b60c7bd6ed45159 当密码正确时我收到(为什么它包含“有效负载”:“登录错误”?)
Array [
Object {
"type": "login_user",
},
Object {
"payload": Object {
"name": "signedUser",
},
"type": "login_user_success",
},
Object {
"payload": "Cannot read property 'dispatch' of undefined",
"type": "login_user_fail",
},
]
当我使用错误的密码时,我收到了(如我所料)
Array [
Object {
"type": "login_user",
},
Object {
"payload": "signIn error ",
"type": "login_user_fail",
},
]
我发现了错误。这是由 NavigationService 调用引起的。
当我使用 redux-thunk 时,我不得不将其更改为 dispatch(() => NavigationService.navigate('Home'));