32 lines
677 B
JavaScript
32 lines
677 B
JavaScript
import { assign } from '@ember/polyfills';
|
|
import ApplicationAdapter from './application';
|
|
|
|
export default ApplicationAdapter.extend({
|
|
namespace: 'v1',
|
|
urlForItem() {},
|
|
|
|
fetchByQuery(store, query, isList) {
|
|
const { id } = query;
|
|
let data = {};
|
|
if (isList) {
|
|
data.list = true;
|
|
}
|
|
|
|
return this.ajax(this.urlForItem(id, isList), 'GET', { data }).then(resp => {
|
|
const data = {
|
|
id,
|
|
method: id,
|
|
};
|
|
return assign({}, resp, data);
|
|
});
|
|
},
|
|
|
|
query(store, type, query) {
|
|
return this.fetchByQuery(store, query, true);
|
|
},
|
|
|
|
queryRecord(store, type, query) {
|
|
return this.fetchByQuery(store, query);
|
|
},
|
|
});
|