2016-02-15 22:33:44 +09:00
|
|
|
// import React from 'react';
|
|
|
|
|
2016-02-16 15:08:30 +09:00
|
|
|
const PostContainer = React.createClass({
|
2016-02-15 22:33:44 +09:00
|
|
|
|
|
|
|
// propTypes: {
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
mixins: [ReactMeteorData],
|
|
|
|
|
|
|
|
getMeteorData() {
|
|
|
|
|
2016-02-16 15:08:30 +09:00
|
|
|
const subscription = Meteor.subscribe('posts.single', this.props._id);
|
2016-02-15 22:33:44 +09:00
|
|
|
|
|
|
|
return {
|
|
|
|
post: Posts.findOne(this.props._id)
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
render() {
|
2016-02-16 15:08:30 +09:00
|
|
|
|
|
|
|
const PostComponent = Telescope.getComponent(this.props.component); // could be Post or PostEdit
|
|
|
|
|
2016-02-15 22:33:44 +09:00
|
|
|
if (this.data.post) {
|
|
|
|
return (
|
2016-02-16 15:08:30 +09:00
|
|
|
<PostComponent {...this.data.post} />
|
2016-02-15 22:33:44 +09:00
|
|
|
)
|
|
|
|
} else {
|
|
|
|
return <p>Loading…</p>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-16 15:08:30 +09:00
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = PostContainer;
|