Switching to @Radium decorator
This commit is contained in:
@@ -9,8 +9,8 @@ import logoImage from 'images/logo.png'
|
||||
import { versionInfo } from './version'
|
||||
import { sizeInfo, colorInfo } from 'ui/style'
|
||||
import { api } from 'src/API'
|
||||
import { reactAutoBind } from 'auto-bind2'
|
||||
import PropTypes from 'prop-types'
|
||||
import autobind from 'autobind-decorator'
|
||||
|
||||
export class App extends Component {
|
||||
static propTypes = {
|
||||
@@ -19,16 +19,11 @@ export class App extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props)
|
||||
reactAutoBind(this)
|
||||
this.state = {
|
||||
loggedInUser: api.loggedInUser
|
||||
}
|
||||
}
|
||||
|
||||
handleUpdate() {
|
||||
this.setState({ loggedInUser: api.loggedInUser })
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
api.addListener('login', this.handleUpdate)
|
||||
api.addListener('logout', this.handleUpdate)
|
||||
@@ -39,6 +34,11 @@ export class App extends Component {
|
||||
api.removeListener('logout', this.handleUpdate)
|
||||
}
|
||||
|
||||
@autobind
|
||||
handleUpdate() {
|
||||
this.setState({ loggedInUser: api.loggedInUser })
|
||||
}
|
||||
|
||||
handleLogout() {
|
||||
// We have to use window here because App does not have history in it's props
|
||||
window.location.replace('/logout')
|
||||
@@ -52,6 +52,7 @@ export class App extends Component {
|
||||
window.location.replace('/profile')
|
||||
}
|
||||
|
||||
@autobind
|
||||
handleChangeTitle(title) {
|
||||
this.setState({ title })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user