axios.get(this.prod_v2_url + 'orders/progress_order_validation/' + this.id, {
headers: {
'Authorization': `Bearer ${this.api_token}`,
'Accept' : 'application/json'
}
}).then((response) => {
this.results = response.data.data.drafts
console.table(this.results)
});
import axios from 'axios';
// use a middleware to intercept this action and pull token
// axios will automatically include header in all http requests
export function setToken(token) {
axios.defaults.headers.common['Authorization'] =
`Bearer ${token}`;
}
const createPostRequest = async () => {
try{
const { data } = await axios.post(url, body_data, {
headers: {
'Authorization': `Basic ${token}`
},
})
console.log(data)
} catch (error) {
console.log(error)
}
}
createPostRequest();