Observable, unresponsive

0

I would like to know why the observable is not responding correctly

login.service.ts

import { Injectable } from '@angular/core';
import { HttpClient, HttpEvent } from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
import { map } from 'rxjs/operators';

login(email: string, senha: string): Observable<HttpEvent<any>>{
      return this.http.post<any>('/entrar',
       { email: email, senha: senha })
        .pipe(map(data => {
          if (data[1]) {
            return data[0];
          }else{
            return throwError({ error: { message: 'Usuário ou senha inválido!' } });
          }
        }));
    }

login request

this.loginService.login(this.email, this.senha)
            .pipe(first())
            .subscribe(
                data => {
                  console.log(data);
                },
                error => {
                  console.log(error);
                });

response:

Observable {_isScalar: false, _subscribe: ƒ}
_isScalar
:
false
_subscribe
:
subscriber => subscriber.error(error)
__proto__
:
Object
    
asked by anonymous 26.07.2018 / 01:06

0 answers