Moved check for existing timer interrupt outside of if-else block for sanity

Этот коммит содержится в:
Reed Garmsen
2015-07-09 18:23:14 -07:00
родитель 582c94cee9
Коммит b4b0e92fd4

Просмотреть файл

@@ -49,6 +49,11 @@ module.exports = React.createClass({
_onError: function() { _onError: function() {
var errorState = getStateFromStores(); var errorState = getStateFromStores();
if (this.state.timerInterrupt != null) {
window.clearInterval(this.state.timerInterrupt);
this.setState({ timerInterrupt: null });
}
if (errorState.message === "There appears to be a problem with your internet connection") { if (errorState.message === "There appears to be a problem with your internet connection") {
this.setState({ connection: " bad-connection" }); this.setState({ connection: " bad-connection" });
var timerInterrupt = window.setInterval(this._onTimerInterrupt, 5000); var timerInterrupt = window.setInterval(this._onTimerInterrupt, 5000);
@@ -56,10 +61,6 @@ module.exports = React.createClass({
} }
else { else {
this.setState({ connection: "" }); this.setState({ connection: "" });
if (this.state.timerInterrupt != null) {
window.clearInterval(this.state.timerInterrupt);
this.setState({ timerInterrupt: null });
}
} }
}, },
_onTimerInterrupt: function() { _onTimerInterrupt: function() {