Created
June 4, 2018 22:31
-
-
Save goofballLogic/bbfdc86fbcd5891c89fc055ed8ff3e6b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendJSON( method, data, url ) { | |
return fetch( url, { | |
body: data && JSON.stringify( data ), | |
method: "POST", | |
mode: "cors", | |
headers: { | |
"Content-Type": "application/json" | |
} | |
} ); | |
} | |
export function saveForLater( person ) { | |
return sendJSON( | |
"POST", person, | |
"http://localhost:3001/for-later" | |
); | |
} | |
export function fetchForLater() { | |
return fetch( "http://localhost:3001/for-later" ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment