Issue
loginNew(logindata:any){
this.service.loginUser(this.user).subscribe(()=>{
console.warn(logindata);
this.alertify.success("Successfully entered!");
window.setTimeout(function(){location.reload()},2000);});
}
This is my function but I don't know how to write if the entrance is invalid.
Solution
What you want to do is to return a success function in case of success, or a failure function in case of failure.,
In that case, You will be able to control the user output for whatever outcomes.
loginNew(logindata:any){
this.service.loginUser(this.user).subscribe(
(success) => {
console.warn(logindata);
this.alertify.success("Successfully entered!");
window.setTimeout(function(){location.reload()},2000);});
},
(failure) => {
alert(failure.message)
}
}
Answered By - Shachar297
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.