samedi 7 septembre 2019

Laravel: form with axios not saving

I'm writing an User Edit functionality with vue.js front-end.

The axios part:

sendUserData(){
                axios.post('/api/saveUser', {
                        id: this.id,
                        name: this.name,
                        email: this.email,
                        password: this.password
                    },
                    {
                        headers: {
                            Authorization: 'Bearer ' + localStorage.getItem('token')
                        }
                    }
                ).then(response => {
                    console.log(response.data);
                    if(response.data == 'success'){
                        this.$emit('userSaveSuccess')
                    } else {
                        this.$emit('userSaveError')
                    }
                });

The output is success, but in the Database there isn't any changes. I tried with Postman too, and that time the data is changed, so the controller is working properly. What's the matter with this part?



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

Aucun commentaire:

Enregistrer un commentaire