-
-
Save GabrielCW/da2c95ace69913885513 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 UrlTemplates from "ember-data-url-templates"; | |
export default DS.RESTAdapter.extend(UrlTemplates, { | |
urlTemplate: '{+host}/posts/{postId}/comments/{id}', | |
findUrlTemplate: '{+host}/comments/{id}', | |
createRecordUrlTemplate: '{+host}/users/{userId}/comments', | |
currentUser: Ember.inject.service(), | |
urlSegments: { | |
postId(type, id, snapshot, query) { | |
return snapshot.belongsTo('post', { id: true }); | |
}, | |
userId() { | |
return this.get('currentUser.id'); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment