mirror of
https://github.com/wassname/talk.git
synced 2026-08-07 11:29:44 +08:00
Support for hooks, preSubmit and postSubmit
This commit is contained in:
@@ -3,14 +3,33 @@ import styles from './styles.css';
|
||||
|
||||
class OffTopicCheckbox extends React.Component {
|
||||
|
||||
handleChange = () => {
|
||||
console.log('handle Change');
|
||||
handleChange = (e) => {
|
||||
|
||||
if (e.target.checked) {
|
||||
this.props.addCommentHooks({
|
||||
postSubmit: {
|
||||
addTag: (data) => {
|
||||
console.log('This is a hook after posting')
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.props.addCommentHooks({
|
||||
postSubmit: {
|
||||
addTag: () => {}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<div className={styles.offTopic}>
|
||||
<label>
|
||||
{/*{console.log(this.props)}*/}
|
||||
<input type="checkbox" onChange={this.handleChange}/>
|
||||
Off-Topic
|
||||
</label>
|
||||
|
||||
Reference in New Issue
Block a user