mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
dfd6d444c3
- fix ember-data complex default value returning in post model - fix mirage returning a user of id 'me' from /user/me
34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
import ApplicationAdapter from 'ghost-admin/adapters/application';
|
|
import SlugUrl from 'ghost-admin/mixins/slug-url';
|
|
|
|
export default ApplicationAdapter.extend(SlugUrl, {
|
|
find(store, type, id) {
|
|
return this.findQuery(store, type, {id, status: 'all'});
|
|
},
|
|
|
|
// TODO: This is needed because the API currently expects you to know the
|
|
// status of the record before retrieving by ID. Quick fix is to always
|
|
// include status=all in the query
|
|
findRecord(store, type, id, snapshot) {
|
|
let url = this.buildIncludeURL(store, type.modelName, id, snapshot, 'findRecord');
|
|
|
|
url += '&status=all';
|
|
|
|
return this.ajax(url, 'GET');
|
|
},
|
|
|
|
findAll(store, type, id) {
|
|
return this.query(store, type, {id, status: 'all'});
|
|
},
|
|
|
|
queryRecord(store, type, query) {
|
|
if (!query || query.id !== 'me') {
|
|
return this._super(...arguments);
|
|
}
|
|
|
|
let url = this.buildURL(type.modelName, 'me', null, 'findRecord');
|
|
|
|
return this.ajax(url, 'GET', {data: {include: 'roles'}});
|
|
}
|
|
});
|