@Cephaz wrote:
Hello,
In my file a have this code
const data = () => {
axios.get(‘https://localhost:3000/api/events’,{
headers: {
‘Access-Control-Allow-Origin’: ‘*’,
}
})
.then(res => {
console.log(res.data);
})
.catch(function (error) {
console.log(error);
})
}
The code not working for my local api and I don’t know how to fix it.This is the console display
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://localhost:3000/api/events. (Reason: CORS request did not succeed)
Please i need help
Posts: 2
Participants: 2