1const headers = {
2 'Content-Type': 'application/json',
3 'Authorization': 'JWT fefege...'
4}
5
6axios.post(Helper.getUserAPI(), data, {
7 headers: headers
8 })
9 .then((response) => {
10 dispatch({
11 type: FOUND_USER,
12 data: response.data[0]
13 })
14 })
15 .catch((error) => {
16 dispatch({
17 type: ERROR_FINDING_USER
18 })
19 })
1axios.post('url', {"body":data}, {
2 headers: {
3 'Content-Type': 'application/json'
4 }
5 }
6)
1// Send a POST request
2axios({
3 method: 'post',
4 url: '/user/12345',
5 data: {
6 firstName: 'Fred',
7 lastName: 'Flintstone'
8 }
9});
1header("Access-Control-Allow-Origin: *");
2header("Access-Control-Allow-Methods: GET, POST, OPTIONS, HEAD");
3header("Access-Control-Allow-Headers: Content-Type, header1");
4