I have some data relating to authorization that needs to be included in every ajax request. How would I include this in a base class without having to include it in every single one of my models.
For example:
client_id: 'myAppId'
should be part of every ajax request.
I had a look at ajaxConfig .. but this only lets me set headers and and xhr options, but does not seem to provide a way to include data.
I also looked at the "request" module on npm, but even there I couldn't find a neat way to always inject some data into every request.
In AngularJS I saw an example of an "authentication injector service" ... how would I achieve this with Ampersand?
Altering the data of a model before going to and after coming from the server is typically handled by serialize and parse, respectively. Would this work for your case?
Hi There,
I have some data relating to authorization that needs to be included in every ajax request. How would I include this in a base class without having to include it in every single one of my models.
For example:
client_id: 'myAppId'
should be part of every ajax request.
I had a look at ajaxConfig .. but this only lets me set headers and and xhr options, but does not seem to provide a way to include data.
I also looked at the "request" module on npm, but even there I couldn't find a neat way to always inject some data into every request.
In AngularJS I saw an example of an "authentication injector service" ... how would I achieve this with Ampersand?
Thanks,
Oliver