Skip to content

Instantly share code, notes, and snippets.

@sharkyak
Last active September 18, 2017 06:18
Show Gist options
  • Save sharkyak/0b461dfd3c8417e6a76a6315489a8856 to your computer and use it in GitHub Desktop.
Save sharkyak/0b461dfd3c8417e6a76a6315489a8856 to your computer and use it in GitHub Desktop.
fetch post
function getDataFromApi (summ) {
return new Promise((resolve, reject) => {
/* global fetch */
fetch('https://gehaltsrechner.bonushammer.com/gettax', {
method: 'POST',
headers: new Headers({'Content-Type': 'application/json'}),
body: JSON.stringify({summ})
})
.then(blob => blob.json())
.then(data => resolve(data))
.catch(err => reject(err))
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment