0

I have created a submit function to handle login,

However VS code crosses through .subscribe and says "Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8." (method) Observable.subscribe(next?: ((value: any) => void) | null | undefined, error?: ((error: any) => void) | null | undefined, complete?: (() => void) | null | undefined): Subscription (+2 overloads)

I am new to TypeScript and JavaScript and need some help implimenting this fix, it would be much appreciated.

onSubmit(): void {
    if (this.loginForm.valid) {
      this.auth.login(this.loginForm.value).subscribe(
        (result) => {
          this.router.navigate(['admin']);
        },
        (err: Error) => {
          alert(err.message)
        }
      );

Is my code for the function.

palz124
  • 1
  • 1
  • Does this answer your question? [Subscribe is deprecated: Use an observer instead of an error callback](https://stackoverflow.com/questions/55472124/subscribe-is-deprecated-use-an-observer-instead-of-an-error-callback) –  Oct 26 '22 at 01:04

0 Answers0