axios post with header
const headers = {
'Content-Type': 'application/json',
'Authorization': 'JWT fefege...'
}
axios.post(Helper.getUserAPI(), data, {
headers: headers
})
.then((response) => {
dispatch({
type: FOUND_USER,
data: response.data[0]
})
})
.catch((error) => {
dispatch({
type: ERROR_FINDING_USER
})
})// Send a POST request
axios({
method: 'post',
url: '/user/12345',
data: {
firstName: 'Fred',
lastName: 'Flintstone'
},
headers: {'Authorization': 'Bearer ...'}
});
Also in JavaScript:
- javascript get day of year from date
- react replace all line breaks with br
- javascript conditional
- java code that writes code in powerpoint
- get multiple checkbox value in javascript
- javvascript convert boolean to string
- conditional rendering alert if input fields are empty
- ad data to js object
- /on in jquery
- jquery ajax json
- javascript remover acentos
- javascript swap images on mouseover
- JQuery UI Saving Sortable List
- url to blob js
- javascript fisher yates shuffle mdn
- pdfjs customizing viewer.html js event handler
- javascript dom methods list
- reduce method in javascript array of bjects
- how to use dotenv in javascript
- lodash pascal case
- angular one way property binding
- react keep screen on
- create array javascript fill
- req.params.id in nodejs