-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [x] Strip jQuery in ember-cli-build.js * [x] Try to ember-data to use ember-fetch instead of $.ajax * [x] app/adapters/application.js added the authorization: <bearer token> header to outgoing requests * [x] ma-create-media guards against disabled button * [x] updated dependencies
- Loading branch information
Showing
3 changed files
with
25 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
import { get } from '@ember/object'; | ||
import { inject as service } from '@ember/service'; | ||
import JSONAPIAdapter from 'ember-data/adapters/json-api'; | ||
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin'; | ||
import AdapterFetchMixin from 'ember-fetch/mixins/adapter-fetch'; | ||
import config from 'mir/config/environment'; | ||
|
||
export default JSONAPIAdapter.extend(DataAdapterMixin, { | ||
export default JSONAPIAdapter.extend(AdapterFetchMixin, { | ||
session: service(), | ||
|
||
/* Ember */ | ||
host: config.DS.host, | ||
namespace: config.DS.namespace, | ||
|
||
/* DataAdapterMixin */ | ||
authorizer: 'authorizer:oauth2' | ||
authorizer: 'authorizer:oauth2', | ||
|
||
/* mir */ | ||
ajaxOptions() { | ||
const authorizer = get(this, 'authorizer'); | ||
const options = this._super(...arguments) || {}; | ||
options.headers = options.headers || {}; | ||
options.headers['Content-Type'] = 'application/vnd.api+json'; | ||
get(this, 'session').authorize(authorizer, (headerName, headerValue) => { | ||
options.headers[headerName] = headerValue; | ||
}); | ||
return options; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters