2016-05-24 15:06:59 +03:00
|
|
|
import ApplicationAdapter from 'ghost-admin/adapters/application';
|
2022-02-02 19:57:22 +03:00
|
|
|
import SlugUrl from 'ghost-admin/utils/slug-url';
|
|
|
|
|
|
|
|
export default class User extends ApplicationAdapter {
|
|
|
|
buildURL(_modelName, _id, _snapshot, _requestType, query) {
|
|
|
|
let url = super.buildURL(...arguments);
|
|
|
|
|
|
|
|
return SlugUrl(url, query);
|
|
|
|
}
|
2014-08-06 20:48:18 +04:00
|
|
|
|
2017-01-14 00:14:54 +03:00
|
|
|
queryRecord(store, type, query) {
|
|
|
|
if (!query || query.id !== 'me') {
|
2022-02-02 19:57:22 +03:00
|
|
|
return super.queryRecord(...arguments);
|
2017-01-14 00:14:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
let url = this.buildURL(type.modelName, 'me', null, 'findRecord');
|
|
|
|
|
|
|
|
return this.ajax(url, 'GET', {data: {include: 'roles'}});
|
2014-07-21 01:48:24 +04:00
|
|
|
}
|
2022-02-02 19:57:22 +03:00
|
|
|
}
|