xxxxxxxxxx
const config = {
headers: { Authorization: `Bearer ${token}` }
};
Axios.post(
'http://localhost:8000/api/v1/get_token_payloads',
config
).then(console.log).catch(console.log);
xxxxxxxxxx
axios.get(`/api/users`, {
headers: {
Authorization: `Bearer ${YOUR_TOKEN}`
}
})
xxxxxxxxxx
const instance = axios.create({
baseURL: 'https://some-domain.com/api/',
timeout: 1000,
headers: {'Authorization': 'Bearer '+token}
});
instance.get('/path')
.then(response => {
return response.data;
})
xxxxxxxxxx
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);