diff --git a/src/app/actions/Actions.js b/src/app/actions/Actions.js index 2d1ee00..3999f3d 100644 --- a/src/app/actions/Actions.js +++ b/src/app/actions/Actions.js @@ -5,9 +5,13 @@ import api from '../utils/api' export default { fetchData () { + console.log('Fetching data') + api((error, data) => { if (error) throw new Error(error) + console.log('Data fetched successfully') + AppDispatcher.dispatch({ type: ActionTypes.COIN_DATA, data: { diff --git a/src/app/components/Footer.jsx b/src/app/components/Footer.jsx index 0a657ac..8e3b466 100644 --- a/src/app/components/Footer.jsx +++ b/src/app/components/Footer.jsx @@ -21,7 +21,7 @@ export default class Footer extends React.Component { } this.quit = this.quit.bind(this) - this.updateInterval = this.updateInterval.bind(this) + this.setUpdateInterval = this.setUpdateInterval.bind(this) this.openGitHubLink = this.openGitHubLink.bind(this) this.renderIntervalOptions = this.renderIntervalOptions.bind(this) this.renderRightButtonGroup = this.renderRightButtonGroup.bind(this) @@ -32,7 +32,7 @@ export default class Footer extends React.Component { } componentDidMount () { - this.updateInterval() + this.setUpdateInterval()() } quit () { @@ -43,14 +43,14 @@ export default class Footer extends React.Component { shell.openExternal(pkg.homepage) } - updateInterval (interval = this.state.interval) { + setUpdateInterval (interval = this.state.interval) { return () => { this.setState({ interval: interval }) if (this.updateIntervalHandler) clearInterval(this.updateIntervalHandler) - this.updateIntervalHandler = setInterval(() => Actions.fetchData, interval) + this.updateIntervalHandler = setInterval(Actions.fetchData, interval) } } @@ -61,7 +61,7 @@ export default class Footer extends React.Component { 'active': interval === this.state.interval }) - return + return }) }