Skip to content

Conversation

@gmverdon
Copy link
Owner

@gmverdon gmverdon commented Feb 6, 2018

No description provided.

} else {
this.setAlert(true, `The bot was unable to sell. ${error.toString()}.`, 'danger');
this.setSellEnabled(false);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add return statement to if & remove else block

checkAPIKeys = () => {
const { key, secret } = this.props.opts.binance;
if (!key || !secret) {
this.setAlert(true, 'API key/secret not defined. Take a look at the readme on how to add these and restart the server.', 'danger');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.setAlert(
  true,
  'API key/secret not defined. Take a look at the readme on how to add these and restart the server.',
  'danger'
);

}
};

setAlert = (open, message, color) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This micro API is vague and unnecessary. You're better of without it, really

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When removing this method, there will be much duplicated code to implement the same functionality.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No there won't be since you're essentially just setting the state.
You could replace a call to setAlert like this:

setAlert(true, 'Foobar', 'warning');

with this:

this.setState({
  alert: {
    open: true,
    message: 'Foobar',
    color: 'warning',
  },
});

This is longer but much, much much more clear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants