Skip to content

Commit 396c600

Browse files
committed
📔 docs: add data() hook usage with Method
1 parent 43828b3 commit 396c600

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎docs/hooks/data.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
`.data()` is triggered right after all resources in `.waitOn()` and `.waitOnResources()` hooks are ready. __This hook can be async__
1010

1111
```js
12+
// USE data() HOOK WITH PUBLISH / SUBSCRIBE
1213
FlowRouter.route('/post/:_id', {
1314
name: 'post',
1415
waitOn(params) {
@@ -18,6 +19,14 @@ FlowRouter.route('/post/:_id', {
1819
return await PostsCollection.findOneAsync({ _id: params._id });
1920
}
2021
});
22+
23+
// USE data() HOOK WITH METEOR METHOD
24+
FlowRouter.route('/post/:_id', {
25+
name: 'post',
26+
async data(params, qs) {
27+
return await Meteor.callAsync('post.get', params._id);
28+
}
29+
});
2130
```
2231

2332
#### Passing data into a *Template*

0 commit comments

Comments
 (0)