Problem with modal in Laravel and Vue.js

Asked

Viewed 115 times

0

Hello to all of you! I am working with a CRUD application in Windows and Vue.js and at the moment I am facing the following problem I created a modal to update a table, the modal does the re-ordering of objects correctly on the input campus, the problem is that by clicking save the modal does not disappear, not saved and what is more strange and that no error code appears in the console, I am completely without reference to what is the error.

inserir a descrição da imagem aqui

new Vue({
    el: '#tableprod',

created: function () {
    this.getProdutos();
},
data () {
    return {
      produtos:[],
      fillproduto:{'id':'','nome_pro':'','descricao_pro':'' },  
    }
  },
methods:{
     editprod:function(produto){
     this.fillproduto.id= produto.id;
     this.fillproduto.nome_pro=produto.nome_pro;
     this.fillproduto.descricao_pro=produto.descricao_pro;
     $('#edit').modal('show');
     },
       updat:function(id){
       var url='updateprod/'+ id;
       axios.put(url, this.fillproduto).then(response=>{
       this.getProdutos();
       this.fillproduto={'id':'','nome_pro':'','descricao_pro':'' };
       $('#edit').modal('toggle');
       });
       },
     }

Route used in Xios for update

|        | PUT      | admin/updateprod/{id}        | componet_2.produtos | App\Http\Controllers\ProdutoController@updateProd     | web  
  • A question: does the request bring a status response 200? I mean, if you go to Inspect Element and enter the Network tab, check there if it is returning with 200 status.

  • Hello Matheus Cristian! This bringing status 500.

  • Richard Carlos, I believe that as the result is giving 500 (internal error on the server), is not calling the function by "then" you can create a "catch" right after to treat the error and close the modal: .catch(error => { $('#edit').modal('toggle'); }). I hope I’ve helped.

  • Thanks for saving! Matheus Cristian

  • ;) Anything, I’m around, be good.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.