added 260907 version of worker toolkit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import ActiveModelAdapter from 'active-model-adapter';
|
||||
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
|
||||
import ENV from 'flaredown/config/environment';
|
||||
|
||||
export default ActiveModelAdapter.extend(DataAdapterMixin, {
|
||||
host: ENV.apiHost,
|
||||
namespace: 'api',
|
||||
coalesceFindRequests: true,
|
||||
// defaults
|
||||
// identificationAttributeName: 'email'
|
||||
// tokenAttributeName: 'token'
|
||||
authorize(xhr) {
|
||||
let { email, token } = this.get('session.data.authenticated');
|
||||
let authData = `Token token="${token}", email="${email}"`;
|
||||
xhr.setRequestHeader('Authorization', authData);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
import ApplicationAdapter from 'flaredown/adapters/application';
|
||||
|
||||
export default ApplicationAdapter.extend({
|
||||
ajaxOptions() {
|
||||
let hash = this._super(...arguments);
|
||||
|
||||
if (localStorage.oracleToken) {
|
||||
let { beforeSend } = hash;
|
||||
|
||||
hash.beforeSend = (xhr) => {
|
||||
xhr.setRequestHeader('X-Oracle-Token', localStorage.oracleToken);
|
||||
|
||||
if (beforeSend) {
|
||||
beforeSend(xhr);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return hash;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import Ember from 'ember';
|
||||
import ApplicationAdapter from 'flaredown/adapters/application';
|
||||
|
||||
const {
|
||||
getProperties,
|
||||
$,
|
||||
} = Ember;
|
||||
|
||||
export default ApplicationAdapter.extend({
|
||||
urlForDeleteRecord(id, modelName, snapshot) {
|
||||
if (typeof FastBoot === 'undefined') {
|
||||
const params = $.param({ reaction: getProperties(snapshot.serialize(), 'value', 'reactable_id', 'reactable_type') });
|
||||
|
||||
return `${this._buildURL(modelName, id)}?${params}`;
|
||||
}
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user