samedi 25 mars 2017

How do Laravel get GET request made by vue.js?

Vue.js HTTP call

        methods :{
        login(){
            var data ={
                client_id: 2,
                client_secret: '5YVQ6rsSehoh5BOWsxAU3KxGeqT1tCRGHn5dx1iX',
                grant_type: 'password',
                username : this.email,
                password: this.password
            }
            //send a GET request using Vue-Resource
            this.$http.get("http://localhost/kubikt2/public/api/login", data)
                .then(response=>{
                    console.log(response)

                })

        }

    }

Laravel

Route::get('api/login',function(Illuminate\Http\Request $req){

echo   $req->getContent();
}

As you can see, echo $req->getContent(); return nothing in Laravel. enter image description here

How do I access the var data sent by Vue.js in Laravel ?



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

Aucun commentaire:

Enregistrer un commentaire