fix PostsEditForm (no need of wrapping in container, it already has the data); clean unnecessary propTypes / import

This commit is contained in:
xavcz 2016-11-12 14:11:36 +01:00
parent c2117a6fcc
commit be0576d125
2 changed files with 10 additions and 14 deletions

View file

@ -56,29 +56,26 @@ class PostsEditForm extends Component {
return (
<div className="posts-edit-form">
{this.renderAdminArea()}
<Telescope.components.PostsSingleContainer
postId={this.props.post._id}
component={NovaForm}
componentProps={{
collection: Posts,
mutationName: "postsEdit",
resultQuery: Posts.graphQLQueries.single,
successCallback: (post) => {
this.context.closeCallback();
this.props.flash(this.context.intl.formatMessage({id: "posts.edit_success"}, {title: post.title}), 'success');
}
<NovaForm
collection={Posts}
mutationName="postsEdit"
document={this.props.post}
resultQuery={Posts.graphQLQueries.single}
successCallback={post => {
this.context.closeCallback();
this.props.flash(this.context.intl.formatMessage({id: "posts.edit_success"}, {title: post.title}), 'success');
}}
/>
<hr/>
<a onClick={this.deletePost} className="delete-post-link"><Telescope.components.Icon name="close"/> <FormattedMessage id="posts.delete"/></a>
</div>
)
);
}
}
PostsEditForm.propTypes = {
flash: React.PropTypes.func,
novaFormMutation: React.PropTypes.func,
post: React.PropTypes.object.isRequired,
}

View file

@ -1,6 +1,5 @@
import Telescope from 'meteor/nova:lib';
import React, { PropTypes, Component } from 'react';
import Posts from "meteor/nova:posts";
import Users from "meteor/nova:users";
import { graphql } from 'react-apollo';
import gql from 'graphql-tag';