diff options
author | 2018-07-06 01:32:43 +0300 | |
---|---|---|
committer | 2023-01-13 10:37:53 +0300 | |
commit | 7f25b0f261b5a5fc2696054004fb24673375b91b (patch) | |
tree | 38ee591e176b4799e39eff7a16f1950e017e7bb4 /vnext/src/components/Thread.js | |
parent | 88732ba8c06c23a93f7248b6eabc182f38be3d33 (diff) |
Proptypes & eslint
Diffstat (limited to 'vnext/src/components/Thread.js')
-rw-r--r-- | vnext/src/components/Thread.js | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/vnext/src/components/Thread.js b/vnext/src/components/Thread.js index 52ca1f0f..7ec6fff6 100644 --- a/vnext/src/components/Thread.js +++ b/vnext/src/components/Thread.js @@ -1,4 +1,8 @@ import React from 'react'; + +import ReactRouterPropTypes from 'react-router-prop-types'; +import { UserType } from './Types'; + import { Link } from 'react-router-dom'; import moment from 'moment'; @@ -31,10 +35,10 @@ export default class Thread extends React.Component { const { mid } = this.props.match.params; let params = { mid: mid - } - if (this.props.visitor && this.props.visitor.hash) { - params.hash = this.props.visitor.hash }; + if (this.props.visitor && this.props.visitor.hash) { + params.hash = this.props.visitor.hash; + } getMessages('/thread', params) .then(response => { let msg = response.data.shift(); @@ -64,9 +68,9 @@ export default class Thread extends React.Component { postComment = (template) => { const { mid, rid, body, attach } = template; comment(mid, rid, body, attach).then(res => { - this.loadReplies() + this.loadReplies(); }) - .catch(console.log) + .catch(console.log); } render() { @@ -155,7 +159,14 @@ export default class Thread extends React.Component { const linkStyle = { cursor: 'pointer' -} +}; + +Thread.propTypes = { + location: ReactRouterPropTypes.location, + history: ReactRouterPropTypes.history, + match: ReactRouterPropTypes.match, + visitor: UserType.isRequired +}; function Recommendations({src, ...rest}) { return src.length > 0 && ( |