From 0719cf39479d7d614a24855fb6291d5410f2b5a8 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Thu, 1 Feb 2018 21:38:08 +0100 Subject: [PATCH] fetch latest on generating --- client/src/App.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/client/src/App.js b/client/src/App.js index ac22638..6c79e36 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -9,8 +9,7 @@ import './App.css'; class App extends Component { componentDidMount() { - getLatest() - .then(latest => this.setState({latest})); + this._getLatest(); } render() { @@ -59,7 +58,14 @@ class App extends Component { pdfError: error.message, pdfUrl: null }); - }); + }) + .then(() => this._getLatest()) + } + + _getLatest() { + getLatest() + .then(latest => this.setState({latest})) + .catch(err => console.error('Unable to get latest:', err)); } _onChange(name, event) {