全部。谁能帮我理解为什么我得到一个 Uncaught (in promise) TypeError: callback is undefined in the below code?它不会出现在 on success 或 on failure 子句中。
const onSubmitPasscode = (event) => {
event.preventDefault();
if (passwordFirst !== passwordSecond) {
alert('the two inputs provided are not the same');
} else {
const user = new CognitoUser({
Username: email,
Pool: UserPool
});
const authDetails = new AuthenticationDetails({
Username: email,
Password: password
});
user.authenticateUser(authDetails, {
onFailure: (err) => {
console.error('onFailure:', err);
},
newPasswordRequired: () => {
user.completeNewPasswordChallenge(passwordFirst, {
onFailure: (err) => {
console.error('onFailure:', err);
},
onSuccess: (result) => {
console.log(passwordFirst);
console.log('call result: ', result);
navigate('dashboard');
}
});
}
});
}