Open kobsy opened 5 years ago
Unless I'm missing something, this actually doesn't work without some minor tweaks I've made here: https://github.com/DuBistKomisch/ember-cli-rails-addon/commit/85fe7f74fc4b0604345986773f0af656db86039f
Huh! Good catch @DuBistKomisch. When I made the change, I just used the existing structure of the add-on, but it seems odd that it was using app
instead of addon
for the directory structure in the first place. 🤔 In any case, I've moved the mixin to addon
as per your suggestion. Thanks! 😁
Actually ended up with an even better idea... you can define a headers
property which is used automatically, instead of manually messing with the XHR: https://github.com/DuBistKomisch/ember-cli-rails-addon/commit/adbb5ae992a36af52e909baf02b06c3ff63e84bd
if the CSRF changes you can add .volatile()
to the computed property, but it doesn't seem to change in my testing
For projects that don't use jQuery, the initializer trying to set
$.ajaxPrefilter
is a show-stopper. Instead of having this as part of an initializer, I opted to follow ember-simple-auth's lead in creating a mixin for an Ember Data adapter. While adding the extra step for the user of including the mixin to an application's adapter, this approach would additionally allow for an app to conditionally add the CSRF token when making requests of servers other than its Rails API.Thoughts?
Closes #36 and #38