I am having same issue as posted this in post How to Call 3rd party API using Azure function and display in SharePoint online Site using SPFx?. Did any one find a solution?
Here is the sample code:
axios
.post('https://api.awardco.com/api/report-api',{
reportName: 'Recognition Details',
returnType: 'JSON',
startDate: '09/1/2023',
endDate: '09/18/2023'
}, {headers: {
'content-type': 'text/json',
'apikey':'APIKEY',
'Access-Control-Allow-Origin':'*Origin*',
'Access-Control-Allow-Methods':'POST',
'Access-Control-Allow-Headers':'Authorization',
'Origin': '*Origin*',
}
})
.then(res=>{
const awards = res.data;
this.setState({awards});
console.log(this.state.awards)
}).catch(function (error) {
console.log(error);
});