It would be nice to add an example to documentation with cross domain request and how to get data from response properly. Because this topic raises many questions. Thanks.
Yes. the documentation is lacking.
+1 This is one of the most important reasons why I haven't be able to fully migrate to vue. I'm trying to develop an api but I can't properly access the data, the get method is not good because makes a new session every time and I need to retrieve specific data from the logged user. I'm stuck. There is some old examples going around but doesn't work with the latest version. Please help.
Agreed more documentation would be nice.
I got it working by this:
Vue.http.options.xhr = {withCredentials: true};
I opened an issue about the lack of documentation (#244). What would you like to include in the docs?
Hm...
I've got the error Request header field Content-Type is not allowed by Access-Control-Allow-Headers
According to this post, may be default setting application/json for Content-Type field header for cors requests is not good idea?
@ak04nv Yes!!
I also met this problem too.
+1
I believe the correct way of doing this going forward is actually this...
Vue.http.options.credentials = true;
CORS cookies dont sended with that options.
Vue.http.options.xhr = {withCredentials: true};
Vue.http.options.emulateJSON = true;
on vuejs2.0 to solve ‘post’ request。
can't figure out how to do JSONP request.. please add an example..
@townfolio sorry I'm so noob on vue, where exactly do set that?. I have this main js from the web-pack
@raphcadiz you should not use vue-resource but rather switch to an external Promises library or use native window.fetch. https://medium.com/the-vue-point/retiring-vue-resource-871a82880af4#.4nk3rlhn9
Did anybody to solve this problem?
@qianthinkover I am not sure if anyone did. Lately, I think many people have been moving towards using axios instead of vue-resource since they are retiring vue-resource: https://medium.com/the-vue-point/retiring-vue-resource-871a82880af4
@qianthinkover did you read my comment above?
Most helpful comment
can't figure out how to do JSONP request.. please add an example..