Skip to content

Instantly share code, notes, and snippets.

@jphungcode
Created October 21, 2020 02:58
Show Gist options
  • Save jphungcode/d46f11fe765fce8504add483f73d708c to your computer and use it in GitHub Desktop.
Save jphungcode/d46f11fe765fce8504add483f73d708c to your computer and use it in GitHub Desktop.
const fetchConfig = {
method: "POST",
headers: {
Authorization: "Bearer " + functions.config().pfc.apikey, //api key is stored as a env variable
"Content-Type": "application/json",
},
body: pfcData,
};
fetch(pfcEndpoint, fetchConfig)
.then((response) => response.json())
.then((result) => {
console.log(result);
resolve(result);
})
.catch((error) => {
console.log(error);
reject(error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment