Removed createContainer
This commit is contained in:
parent
86a94e37e4
commit
311b4ee1f3
8 changed files with 34 additions and 32 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { ButtonToolbar, ButtonGroup, Button } from 'react-bootstrap';
|
||||
import { createContainer } from 'meteor/react-meteor-data';
|
||||
import { withTracker } from 'meteor/react-meteor-data';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Bert } from 'meteor/themeteorchef:bert';
|
||||
import Documents from '../../../api/Documents/Documents';
|
||||
|
|
@ -38,7 +38,9 @@ const renderDocument = (doc, match, history) => (doc ? (
|
|||
</div>
|
||||
) : <NotFound />);
|
||||
|
||||
const ViewDocument = ({ loading, doc, match, history }) => (
|
||||
const ViewDocument = ({
|
||||
loading, doc, match, history
|
||||
}) => (
|
||||
!loading ? renderDocument(doc, match, history) : <Loading />
|
||||
);
|
||||
|
||||
|
|
@ -46,15 +48,15 @@ ViewDocument.propTypes = {
|
|||
loading: PropTypes.bool.isRequired,
|
||||
doc: PropTypes.object,
|
||||
match: PropTypes.object.isRequired,
|
||||
history: PropTypes.object.isRequired,
|
||||
history: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default createContainer(({ match }) => {
|
||||
export default withTracker(({ match }) => {
|
||||
const documentId = match.params._id;
|
||||
const subscription = Meteor.subscribe('documents.view', documentId);
|
||||
|
||||
return {
|
||||
loading: !subscription.ready(),
|
||||
doc: Documents.findOne(documentId),
|
||||
doc: Documents.findOne(documentId)
|
||||
};
|
||||
}, ViewDocument);
|
||||
})(ViewDocument);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue