This repository has been archived on 2025-03-30. You can view files and clone it, but cannot push or open issues or pull requests.
hymenobacterdotinfo/app/services/ajax.js
Matthew Dillon b12ff0eb20 ember-ajax
Fixes #37
Fixes #38
2015-11-12 13:32:41 -07:00

23 lines
615 B
JavaScript

import Ember from 'ember';
import AjaxService from 'ember-ajax/services/ajax';
const { computed, inject: { service } } = Ember;
export default AjaxService.extend({
session: service(),
globals: service(),
host: computed('globals.apiURL', function() {
return `${this.get('globals.apiURL')}/api/${this.get('globals.genus')}`;
}),
headers: computed('session.authToken', {
get: function() {
let headers = {};
this.get('session').authorize('authorizer:application', (headerName, headerValue) => {
headers[headerName] = headerValue;
});
return headers;
}
})
});