SaveComponent.vue: Edit: Send data to server - Api CodeIgniter 4 - 31

The next step would be to make the put request here, we return and execute the post and if not it will enter here in case you don't see it well:

src\router.js

{
   name: 'save',
   path:'/save/:id?',
   component: Save
}
async mounted() {

   if (this.$route.params.id) {
       await this.getMovie()
       this.init()
   }

   this.getCategories()
},

As you can see, it asks for the route ID or for the post or the movie in this case and if it is defined then update and if not, create here so well, there you saw it you can do it yourself skip the video now I am going to move on to the implementation so we return here this same thing is maintained this also to clean the form:

async getMovie() {
   this.movie = await axios.get('http://code4movies.test/api/pelicula/' + this.$route.params.id)
       .then(res => res.data)
       .catch(error => error)
},

I agree to receive announcements of interest about this Blog.

We are going to send the data to the server using an axios request to edit the records.

- Andrés Cruz

En español

This material is part of my complete course and book; You can purchase them from the books and/or courses section, Curso y Libro CodeIgniter 4 desde cero + integración con Bootstrap 4 o 5 - 2025.