Skip to content

Instantly share code, notes, and snippets.

@RobertFischer
Created February 16, 2018 17:38
Show Gist options
  • Save RobertFischer/aedbb41080c57873e0382efe81f5475c to your computer and use it in GitHub Desktop.
Save RobertFischer/aedbb41080c57873e0382efe81f5475c to your computer and use it in GitHub Desktop.
import Promise from "bluebird";
Promise.try(() => axios.get(CAREPLAN_URL))
.tap(response => console.log(CAREPLAN_URL, response))
.then(response => response.data)
.then(data => this.ds.cloneWithRows(data))
.then(dataSource => this.setState({dataSource}))
.catch(e => console.error("Getting careplan failed", CAREPLAN_URL, e)
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment