const config = {
headers: { Authorization: `Bearer ${token}` }
};
Axios.post(
'http://localhost:8000/api/v1/get_token_payloads',
config
).then(console.log).catch(console.log);
{
headers: {
'Authorization': 'Bearer ' + validToken()
}
}
const instance = axios.create({
baseURL: 'https://some-domain.com/api/',
timeout: 1000,
headers: {'Authorization': 'Bearer '+token}
});
instance.get('/path')
.then(response => {
return response.data;
})
const config = {
headers: { Authorization: `Bearer ${token}` }
};
const bodyParameters = {
key: "value"
};
Axios.post(
'http://localhost:8000/api/v1/get_token_payloads',
bodyParameters,
config
).then(console.log).catch(console.log);