Skip to content

Commit

Permalink
Move the message builder logic from render method into a separate fun…
Browse files Browse the repository at this point in the history
…ction, refs UIU-484
  • Loading branch information
adi-mat committed May 15, 2018
1 parent 8b79e18 commit 87bc3bd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion withRenew.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const withRenew = WrappedComponent =>
super(props);
this.renew = this.renew.bind(this);
this.hideModal = this.hideModal.bind(this);
this.getMessage = this.getMessage.bind(this);
this.state = {
errorMsg: [],
bulkRenewal: false
Expand Down Expand Up @@ -205,7 +206,7 @@ const withRenew = WrappedComponent =>
this.setState({ errorMsg: [] });
}

render() {
getMessage() {
const { errorMsg } = this.state;
const errorsLength = errorMsg.length;
let msg = '';
Expand All @@ -221,7 +222,12 @@ const withRenew = WrappedComponent =>
}
});
}
return msg;
}

render() {
const { errorMsg } = this.state;
const msg = this.getMessage();
const popupMessage = `Loan cannot be renewed because: ${msg}`;
return (
<div>
Expand Down

0 comments on commit 87bc3bd

Please sign in to comment.