0
Good morning,
I am trying to create a login screen in Reactjs where a post is done on an api, after sending the user email and password, the API returns the JWT authentication token.
API post in my component (Login.js)
 axios({
            method: 'post',
            url: 'https://localhost:44332/api/token',
            data: corpo,
            config: { headers: { 'Content-Type': 'multipart/form-data' } }
        })
            .then(function (res) {
                // salva o token no localstorage
                localStorage.setItem('token', res.data.token);
            }).catch(function (response) {
                console.log(response);
            });
Is this the right way to do it? How can I redirect my user to another component. ex: Dashboard.js
Grateful, abs