Last active
September 18, 2017 06:18
-
-
Save sharkyak/0b461dfd3c8417e6a76a6315489a8856 to your computer and use it in GitHub Desktop.
fetch post
This file contains hidden or 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 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