Commit a106515206cea5dfce02d44a73397cd1ca3e69f0
1 parent
4c9b3dfc17
Exists in
master
remove superfluous publication in favor of reuse
Showing
2 changed files
with
1 additions
and
6 deletions
Show diff stats
imports/api/documents/server/publications.js
1 | import { Meteor } from 'meteor/meteor'; | 1 | import { Meteor } from 'meteor/meteor'; |
2 | import { check } from 'meteor/check'; | 2 | import { check } from 'meteor/check'; |
3 | import Documents from '../documents'; | 3 | import Documents from '../documents'; |
4 | 4 | ||
5 | Meteor.publish('documents.list', () => Documents.find()); | 5 | Meteor.publish('documents.list', () => Documents.find()); |
6 | 6 | ||
7 | Meteor.publish('documents.view', (_id) => { | 7 | Meteor.publish('documents.view', (_id) => { |
8 | check(_id, String); | 8 | check(_id, String); |
9 | return Documents.find(_id); | 9 | return Documents.find(_id); |
10 | }); | 10 | }); |
11 | |||
12 | Meteor.publish('documents.edit', (_id) => { | ||
13 | check(_id, String); | ||
14 | return Documents.find(_id); | ||
15 | }); | ||
16 | 11 |
imports/ui/containers/EditDocument.js
1 | import { Meteor } from 'meteor/meteor'; | 1 | import { Meteor } from 'meteor/meteor'; |
2 | import { composeWithTracker } from 'react-komposer'; | 2 | import { composeWithTracker } from 'react-komposer'; |
3 | import Documents from '../../api/documents/documents.js'; | 3 | import Documents from '../../api/documents/documents.js'; |
4 | import EditDocument from '../pages/EditDocument.js'; | 4 | import EditDocument from '../pages/EditDocument.js'; |
5 | import Loading from '../components/Loading.js'; | 5 | import Loading from '../components/Loading.js'; |
6 | 6 | ||
7 | const composer = ({ params }, onData) => { | 7 | const composer = ({ params }, onData) => { |
8 | const subscription = Meteor.subscribe('documents.edit', params._id); | 8 | const subscription = Meteor.subscribe('documents.view', params._id); |
9 | 9 | ||
10 | if (subscription.ready()) { | 10 | if (subscription.ready()) { |
11 | const doc = Documents.findOne(); | 11 | const doc = Documents.findOne(); |
12 | onData(null, { doc }); | 12 | onData(null, { doc }); |
13 | } | 13 | } |
14 | }; | 14 | }; |
15 | 15 | ||
16 | export default composeWithTracker(composer, Loading)(EditDocument); | 16 | export default composeWithTracker(composer, Loading)(EditDocument); |
17 | 17 |