Consuming api with validation

0

Next, my método is working correctly, but I would like to do a validation if I can not succeed, letting the user know that I could not adicionarConta() have any way I can do this?
Webservice method

 addConta(conta: ContaInterface){ 
    return this.http.post(this.url+'api/login',conta,{"headers": {'Accept':'application/json','Authorization': 'Bearer '+this.token}}); 

  } 

Add method

adicionaConta(){

     this.webservice.addConta(conta).subscribe(data=>this.listaContas.push(data));

        }

    
asked by anonymous 09.03.2018 / 20:31

0 answers