Last active
November 17, 2021 12:17
-
-
Save cn-2k/90d8c21537d737d104c31aef4ae7879d to your computer and use it in GitHub Desktop.
Axios request
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
// Making post request using axios (with headers too) | |
axios | |
.post('localhost', payload, { | |
headers: { | |
'Content-Type': 'application/json', | |
Authorization: 'Bearer ' + token, | |
}, | |
}) | |
.then(function (response) { | |
console.log(response) | |
}) | |
.catch(error) { | |
console.log(error) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment