mercredi 21 mars 2018

Vue request fails but does not log errors

I have this add method in my vue script

if (this.edit === false) {
     this.link.link = submitEvent.target.elements.link.value;
     fetch('products', {
          method: 'POST',
          body: JSON.stringify(this.link),
          headers: {
             'content-type': 'application/json'
          }
       })
       .then(res => res.json())
       .then(res => {                    // this does not get executed
             this.qrcode.redirect_url = ""; 
             alert('Added');
             this.fetchAll()
       })
      .catch(err => console.log(err.res));
   }
}

When I fill the form the request is send and entry is made to the database but I do not get response. I am using laravel as backend and Add method in Controller returns 200 response after creation. What could cause it and why console.log(err) does not not display anything?



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

Aucun commentaire:

Enregistrer un commentaire