dimanche 2 septembre 2018

Vue.js, Axios multiple get CORS requests to Laravel API are randomly failing

I have this problem - on Vue component created life cycle hook I am making 2 CORS get requests via Axios to external Laravel API. If I make only one of the requests everything is fine and it works 100% of the time. But if I make 2 or more requests I sometimes get failed requests on random in the network tab. Obviously I am doing something wrong with Axios. Can you please help me.

This is my component created hook enter image description here

And this are my actions in VueX enter image description here

Then I get failed requests on random - sometimes both requests are ok (200 status), other times one of them is failing... enter image description here

I think I am doing something wrong with Axios, because its not from my browser or firewall - I have stopped firewall and tested in incognito and other browsers without any extensions. Any help will be appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire