Fala pessoal!
Qual o link da API pra poder autenticar o login? Estou tentando o link: https://instalura-api.herokuapp.com/api/public/login porém está retornando erro tanto pra abir a API no browser quando na chamada do código.
Erro no console quando autentico pela tela de login: POST https://instalura-api.herokuapp.com/api/public/login 415
Erro ao cessar o link pelo browser: Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Jun 13 15:51:34 UTC 2019 There was an unexpected error (type=Method Not Allowed, status=405). Request method 'GET' not supported
Minha requisição:
envia(event) { event.preventDefault();
const requestInfo = {
method: 'POST',
body: JSON.stringify({ login: this.login.value, senha: this.senha.value }),
headers: new Headers({
'Content-type': 'aplication/json'
})
};
fetch('https://instalura-api.herokuapp.com/api/public/login', requestInfo)
.then(response => {
if (response.ok) {
return response.text();
} else {
throw new Error('Não foi possível fazer login');
}
})
.then(token => {
localStorage.setItem('auth-token', token);
browserHistory.push('./timeline');
})
.catch(error => {
this.setState({ msg: error.message });
})
}