Closed JonasDoebertin closed 7 years ago
I think you can do that if you have a Comment model and it has a post_id
in it. Then you'd just set your base route on the comment model /posts/{post_id}/comments
.
The interpolate function will replace anything in {}
with the value in your model: https://github.com/aarondfrancis/vue-model/blob/master/src/Model.js#L320
Let me know if that helps!
Thanks a lot! Works just fine:
{
baseRoute: '/api/posts/{post_id}/comments',
actions: {
create: {
method: 'POST',
route: '',
pipeline: function(DataPipeline) {
DataPipeline.without('post_id');
}
}
}
}
Right now, it's quite hard to use this for nested resources.
Imagine this routes setup:
GET /posts/{post-id}/comments
POST /posts/{post-id}/comments
PUT /posts/{post-id}/comments/{comment-id}
Do you have plans to accommodate for this (however the solution may look)?