diff options
author | Matthew Shao <me@matshao.com> | 2017-03-03 09:14:46 +0800 |
---|---|---|
committer | Matthew Shao <me@matshao.com> | 2017-03-03 09:16:26 +0800 |
commit | 6479bd4e76ec46a14a6f0cb7c3c5c7e56f402b50 (patch) | |
tree | d92b05877112e97fe4acec6a34443e7ef34ed175 /web/src/js/components/Header | |
parent | c397a21980db5619863871bc214552563ae1583d (diff) | |
download | mitmproxy-6479bd4e76ec46a14a6f0cb7c3c5c7e56f402b50.tar.gz mitmproxy-6479bd4e76ec46a14a6f0cb7c3c5c7e56f402b50.tar.bz2 mitmproxy-6479bd4e76ec46a14a6f0cb7c3c5c7e56f402b50.zip |
[web] Simplify the code. (#2085)
Diffstat (limited to 'web/src/js/components/Header')
-rw-r--r-- | web/src/js/components/Header/FilterDocs.jsx | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/web/src/js/components/Header/FilterDocs.jsx b/web/src/js/components/Header/FilterDocs.jsx index f07b8e24..b471840b 100644 --- a/web/src/js/components/Header/FilterDocs.jsx +++ b/web/src/js/components/Header/FilterDocs.jsx @@ -11,7 +11,7 @@ export default class FilterDocs extends Component { constructor(props, context) { super(props, context) - this.state = { doc: FilterDocs.doc, selectHandler: props.selectHandler} + this.state = { doc: FilterDocs.doc } } componentWillMount() { @@ -29,10 +29,6 @@ export default class FilterDocs extends Component { } } - handleClick(e, value){ - this.state.selectHandler(value.split(" ")[0] + " ") - } - render() { const { doc } = this.state return !doc ? ( @@ -41,7 +37,7 @@ export default class FilterDocs extends Component { <table className="table table-condensed"> <tbody> {doc.commands.map(cmd => ( - <tr key={cmd[1]} onClick={e => this.handleClick(e, cmd[0])}> + <tr key={cmd[1]} onClick={e => this.props.selectHandler(cmd[0].split(" ")[0] + " ")}> <td>{cmd[0].replace(' ', '\u00a0')}</td> <td>{cmd[1]}</td> </tr> |