fetch latest on generating

This commit is contained in:
Thomas Ruoff
2018-02-01 21:38:08 +01:00
parent 3f72c35d5a
commit 0719cf3947

View File

@@ -9,8 +9,7 @@ import './App.css';
class App extends Component { class App extends Component {
componentDidMount() { componentDidMount() {
getLatest() this._getLatest();
.then(latest => this.setState({latest}));
} }
render() { render() {
@@ -59,7 +58,14 @@ class App extends Component {
pdfError: error.message, pdfError: error.message,
pdfUrl: null pdfUrl: null
}); });
}); })
.then(() => this._getLatest())
}
_getLatest() {
getLatest()
.then(latest => this.setState({latest}))
.catch(err => console.error('Unable to get latest:', err));
} }
_onChange(name, event) { _onChange(name, event) {