Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auth.service.ts
changePassword(oldPassword, newPassword, callback) { return this.UserService.changePassword({id: this.currentUser._id}, oldPassword, newPassword) .toPromise() .then(() => {console.log("success"); safeCb(callback)(null)}) .catch(err => {console.log("error"); safeCb(callback)(err)}); }
Then in settings.component.ts you do:
changePassword(): void { this.submitted = true; return this.AuthService.changePassword(this.oldPassword, this.password) .then(() => { // success message }) .catch(err => { // incorrect password message }); }
Here // success message is always displayed because safeCb returns undefined.
// success message
safeCb
undefined
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Example
auth.service.ts
Then in settings.component.ts you do:
Here
// success messageis always displayed becausesafeCbreturnsundefined.The text was updated successfully, but these errors were encountered: