Skip to content

Instantly share code, notes, and snippets.

@helfer
Last active April 24, 2018 21:10
Show Gist options
  • Save helfer/6785e7fcfdbfcb7429d27ae639d7b21c to your computer and use it in GitHub Desktop.
Save helfer/6785e7fcfdbfcb7429d27ae639d7b21c to your computer and use it in GitHub Desktop.
// add this import at the top
import fetch from 'node-fetch';
// add this somewhere in the middle
const FortuneCookie = {
getOne() {
return fetch('http://fortunecookieapi.herokuapp.com/v1/cookie')
.then(res => res.json())
.then(res => {
return res[0].fortune.message;
});
},
};
// and at the bottom, modify the export to include FortuneCookie
export { Author, Post, View, FortuneCookie };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment