Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.