Add some more autobinds

This commit is contained in:
John Lyon-Smith
2018-03-23 07:33:52 -07:00
parent 1b35ac8b22
commit 54365d3566
3 changed files with 6 additions and 8 deletions

View File

@@ -2,6 +2,7 @@ import React from 'react'
import { api } from 'src/API'
import PropTypes from 'prop-types'
import { MessageModal, WaitModal } from '../Modal'
import autobind from 'autobind-decorator'
export class ConfirmEmail extends React.Component {
static propTypes = {
@@ -13,7 +14,6 @@ export class ConfirmEmail extends React.Component {
waitModal: null,
messageModal: null
}
this.handleMessageModalDismiss = this.handleMessageModalDismiss.bind(this)
}
componentDidMount(props) {
@@ -47,6 +47,7 @@ export class ConfirmEmail extends React.Component {
}
}
@autobind
handleMessageModalDismiss() {
this.setState({ messageModal: null })
this.props.history.replace('/login')

View File

@@ -2,6 +2,7 @@ import React from 'react'
import { Route, Redirect } from 'react-router-dom'
import { PropTypes } from 'prop-types'
import { api } from 'src/API'
import autobind from 'autobind-decorator'
export class ProtectedRoute extends React.Component {
static propTypes = {
@@ -15,11 +16,7 @@ export class ProtectedRoute extends React.Component {
roles: ['administrator']
}
constructor(props) {
super(props)
this.updateComponent = this.updateComponent.bind(this)
}
@autobind
updateComponent() {
this.forceUpdate()
}

View File

@@ -3,6 +3,7 @@ import PropTypes from 'prop-types'
import { Column, Button, BoundInput, BoundButton } from 'ui'
import { regExpPattern } from 'regexp-pattern'
import { FormBinder } from 'react-form-binder'
import autobind from 'autobind-decorator'
export class ProfileForm extends React.Component {
static propTypes = {
@@ -62,8 +63,6 @@ export class ProfileForm extends React.Component {
constructor(props) {
super(props)
this.handleSubmit = this.handleSubmit.bind(this)
this.state = {
binder: new FormBinder(
this.props.user, ProfileForm.bindings, this.props.onModifiedChanged)
@@ -79,6 +78,7 @@ export class ProfileForm extends React.Component {
}
}
@autobind
handleSubmit(e) {
e.preventDefault()