1π
First of all that JSON.parse is not working as I would expect
See the documentation.
response
is not a string of JSON.
It is an object. The response body is available through the data
property. If the body is JSON, it will be parsed automatically and the result assigned to data
.
Also, the use of finally to be sure that the first request has finished is correct, or it is not?
No. finally
runs when the promise is settled β no matter if it was successful or not.
You almost certainly donβt want to be carrying on if there was an error so you should be using then
.
Do everything in your existing then
callback.
- [Vuejs]-Problem in structuring a proper way to iterate data into html elements in vue
- [Vuejs]-Chaining promises Vuex
Source:stackexchange.com