Created
March 30, 2021 12:07
-
-
Save SuperCipher/366a69c8bc368145b2e4dfbbbd53a8d8 to your computer and use it in GitHub Desktop.
fetch real life example
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 requestBid(eventID,requestSlpAddress) { | |
const url = AUCTION_BACKEND_URL; | |
const data = { | |
eventID: eventID, | |
bidderAddress: requestSlpAddress | |
}; | |
const jsonData = JSON.stringify(data); | |
const params = { | |
headers: { | |
"content-type":"application/json; charset=UTF-8" | |
}, | |
body: jsonData, | |
method: "POST" | |
}; | |
fetch(url, params) | |
.then(data=>{return data.json()}) | |
.then(res=>{console.log('RES', res)}) | |
.catch(error=>console.log('ERROR', error)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment