Created
October 20, 2015 21:50
-
-
Save ksol/36001fe6cf7b582de5c4 to your computer and use it in GitHub Desktop.
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
import ApplicationAdapter from './application'; | |
import UrlTemplates from "ember-data-url-templates"; | |
export default ApplicationAdapter.extend(UrlTemplates, { | |
queryUrlTemplate: '{+host}/posts/{endpoint}', | |
urlSegments: { | |
endpoint(type, id, snapshot, query) { | |
// we're extracting the endpoint from the query object... | |
let ep = query.endpoint; | |
// ... and we delete it, so that the actual query does not contain | |
// a useless "endpoint" | |
delete query.endpoint; | |
return ep; | |
}, | |
} | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
model() { | |
let query = {endpoint: "favorites"}; | |
return this.store.query('post', query); | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment