Skip to content

Commit

Permalink
Cleanup base adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
fsmanuel committed Sep 4, 2022
1 parent e8b8a9f commit 851c89b
Showing 1 changed file with 1 addition and 35 deletions.
36 changes: 1 addition & 35 deletions addon/adapters/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ export default class BaseAdapter extends JSONAPIAdapter {
_debug = false;
coalesceFindRequests = false;

// TODO: v2.0 - What are the defaults now? What versions to support?
isNewSerializerAPI = true;

// TODO: v2.0 - Can we deprecate or remove that? What are the defaults now? What versions to support?
// Reload behavior
shouldReloadRecord() {
return true;
Expand Down Expand Up @@ -99,49 +95,19 @@ export default class BaseAdapter extends JSONAPIAdapter {
return super.deleteRecord(...arguments);
}

// Polyfill queryRecord
queryRecord(store, type, query) {
queryRecord() {
let records = super.queryRecord(...arguments);

if (!records) {
var url = this.buildURL(type.modelName, null, null, 'queryRecord', query);

// TODO: Document why this is needed or remove it!
if (this.sortQueryParams) {
query = this.sortQueryParams(query);
}

records = this.ajax(url, 'GET', { data: query });
}

return records.then(function (result) {
return { data: result.data[0] || null };
});
}

// TODO: v2.0 - What are the defaults now? What versions to support?
// Delegate to _handleStorageRequest
ajax() {
return this._handleStorageRequest.apply(this, arguments);
}

// Delegate to _handleStorageRequest
makeRequest(request) {
return this._handleStorageRequest(request.url, request.method, {
data: request.data,
});
}

// Work arround ds-improved-ajax Feature Flag
_makeRequest() {
return this.makeRequest.apply(this, arguments);
}

// Remove the ajax() deprecation warning
_hasCustomizedAjax() {
return false;
}

// Delegate to _handle${type}Request
_handleStorageRequest(url, type, options = {}) {
if (this._debug) {
Expand Down

0 comments on commit 851c89b

Please sign in to comment.