I'm trying to make a post API with axios. I have a component with axios syntax:
export function postAPI(callback, url, body) {    
    axios.post(url, body, { headers: { 'Key': '*******'}})
        .then(res => callback({ data: res.data, isLoading : false }))
        .catch(err => callback({ error: err, isLoading : false }));
}
and I'm doing a request like this:
 postAPI(result => {
     const { data, error } = result;
     if (error) {
           alert('error')    
     }
     if (data) {
           alert('success')
      }
 }, URL, body });
Objective: I have other post request that must have one more header, but I don't know how to do it in that case...
Someone can help?
 
    