'Output messages for the user

I need your help. I use the toast library to display user messages for my authorization system. I have no mistakes, everything works, but incorrectly. The fact is that the message when I logged in comes, but when entering incorrect data does not work. Tell me, what am I doing wrong? Thank you very much

success_message: string = "You logged in"
error_message: string = "Incorrect data"

coustructor(private toastService: ToastrService) {}

show_success(success_message: string) {
   this.toastService.success(this.success_message)
}

show_error(error_message: string) {
   this.toastService.error(this.error_message)
}

loginToSystem() {
this.tokenSubscription = this.authSerivce.loginUser(
  this.loginForm.controls['username'].value,
  this.loginForm.controls['password'].value,
  this.rememberMeForm.controls['rememberMe'].value).subscribe(() => {
    if (this.tokenSubscription) {
      this.router.navigateByUrl(this.returnUrl)
      this.show_success(this.success_message)
      this.resetForm()
    } else if (!this.tokenSubscription){
      this.show_error(this.error_message)
    }
 })
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source