From 227c01e853a6a15e58aa4cfab6bd8650b509ed5f Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Thu, 28 Jun 2018 09:03:58 -0400 Subject: [PATCH] add bypass getPolls when no polls --- app/dapp.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/dapp.js b/app/dapp.js index 2cbe450..a166914 100644 --- a/app/dapp.js +++ b/app/dapp.js @@ -40,7 +40,9 @@ class App extends React.Component { const { nPolls, poll } = PollManager.methods; const polls = await nPolls.call(); const total = await polls.call(); - getPolls(total, poll).then(rawPolls => { this.setState({ rawPolls })}); + console.log('total', total, polls); + if (total) getPolls(total, poll).then(rawPolls => { this.setState({ rawPolls })}); + else this.setState({ rawPolls: [] }); } _renderStatus(title, available) {