Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

beforeSend option #222

Open
miguelcobain opened this issue Feb 17, 2019 · 2 comments
Open

beforeSend option #222

miguelcobain opened this issue Feb 17, 2019 · 2 comments

Comments

@miguelcobain
Copy link

miguelcobain commented Feb 17, 2019

Seems that some addons like ember-simple-auth make use of the beforeSend option. This option works on jquery ajax: http://api.jquery.com/jQuery.ajax/

Here, for example: https://github.com/simplabs/ember-simple-auth/blob/master/addon/mixins/data-adapter-mixin.js#L97

Would it make sense for AdapterFetch to try to use this option?

At the moment, I don't think it is possible to use ember-simple-auth + ember-data + ember-fetch?

@miguelcobain miguelcobain changed the title beforeSend beforeSend option Feb 17, 2019
@xg-wang
Copy link
Member

xg-wang commented Feb 19, 2019

It's also used in ember-data JSONAPIAdapter, and lots of other addons.

ajaxOptions in the fetch adapter doesn't call super, so other addon's mixins and ember-data's hash w/ beforeSend won't be mixed into ajaxOptions. I'm not sure whether this should happen in the adapter level or we provide such a hook in a fetchService. @rwjblue @nlfurniss Do you have any idea about this?

@nlfurniss
Copy link
Collaborator

nlfurniss commented Feb 21, 2019

@xg-wang other ajaxOptions are def called (the adapter mixin has to be in the correct order).

beforeSend isn't necessary here since the addon could instead change the options passed into ajaxOptions. This would be a code change that would allow it to work with ember-fetch and jQuery.

However, $.prefilter doesn't have any support yet. I'm writing an RFC for how we want to handle prefilter in a jQuery-less world. Keep an eye out :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants