Can you help me, i have a function problematic:
http://localhost:3000
has been blocked by CORS policy: No Access-Control-Allow-Origin
header is present on the requested resource. If an opaque response serves your needs, set the request's mode to no-cors
to fetch the resource:
handleSubmit = e => {
e.preventDefault();
const data={
'username' : this.username,
'password' : this.password
}
fetch(process.env.REACT_APP_API_URL+'/api/login', data,{
method:"POST",
headers:{
'accept': 'application/json',
'Access-Control-Allow-Origin': "*",
'content-type': 'application/x-www-form-urlencoded',
'Access-Control-Allow-Credentials': 'true',
}
})
.then(r => r.json());
}
but there is a problem with the url, how do is solve it? enter image description here