dimanche 27 août 2017

Login in Laravel 5.4 Vue.js app doesn't work

It happens that everything works in my laravel/vue.js application excluding the login that I have to implement now.

I'm using JWT and when I try to login from my Vue template it shows this, but when I test the route created on the back end, it returns the Token without any problem, like this.

Here is the code of my login component of the front-end app...

<script>
import bar from '../bar.vue'
import axios from 'axios';
export default {
    components: {
        'bar': bar,
    },

    data(){
        return {
            email: '',
            password: ''
        }
    },

    methods: {
        login(){
            axios.post('http://localhost:8000/api/signin',
                {
                    email: this.email,
                    password: this.password
                },
                {
                    headers: {'X-Requested-With': 'XMLHttpRequest'}
                }
            )
                .then(
                    (response) => console.log(response)
                )
                .catch(
                    (error) => console.log(error)
                );
        }
    }
}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ggTPcA
via IFTTT

Aucun commentaire:

Enregistrer un commentaire