[Vuejs]-Submit PUT form in vuetify and laravel

0👍

You are already saying to run the update function if the use submits your form.
In your update you do not need to submit the form since the event already exists.

Further I am not sure what this line is doing there:

<form @submit.prevent="update" enctype="multipart/form-data">

Why are you trying to achieve with ...prevent="update"

I would simply post your form using an xhr request, you could use axios for instance like this:

  data() {
    return {
      fields: {},
      errors: {},
    }
  },
  methods: {
    submit() {
      this.errors = {};
      axios.post('/api/usuarios'+this.id, this.fields).then(response => {
        alert('Message sent!');
        // your logic ...
      }).catch(error => {
        if (error.response.status === 422) {
          this.errors = error.response.data.errors || {};
        }
      });
    },

Leave a comment