-1
I’m getting on my console the Bad Request 400 response to my API call:
My app.api.ts in the app folder is:
export const MEAT_API = 'http://localhost:1337'
And my main code is:
submit(){
var link = 'http://localhost:1337/user/login';
var data = '?email='+JSON.stringify(this.usuario.email)+'&senha='+ JSON.stringify(this.usuario.senha);
this.http.post(link, data)
.subscribe(data => {
this.data.response = data._body;
if(this.data.response != "[]"){
var resposta = this.data.response;
console.log(resposta);
// tinha que pegar o ID do usuário.... :/
sessionStorage.setItem("usuarioEmail", this.usuario.email);
//sessionStorage.setItem("idUsusario", resposta[0].idusuarios);
sessionStorage.setItem("flagLogado", "sim");
this.navCtrl.setRoot(WellFitPage, {}, {animate: true, direction: "forward"});
}else{
let alert = this.alertCtrl.create({
title: 'Usuário Não encontrado!',
subTitle: 'Verifique se digitou seu e-mail e senha corretamente.',
buttons: ['OK']
});
alert.present();
}
})
}
I am migrating from Ionic 1 to 3 a lot has changed. What can it be? My API was developed using Sailsjs.
In my Postman, it seems right, see: