I'm making a simple currency converter, and I can't overcome the error:
Here is a part of code:
try {
const { data } = await axios.get(
'https://api.privatbank.ua/p24api/pubinfo?json&exchange&coursid=5',
{
method: 'POST',
mode: 'no-cors',
headers: {
Accept: 'application/json',
WithCredentials: true,
'Access-Control-Allow-Origin': 'http://localhost:3000/',
'Content-Type': 'application/json; charset=UTF-8',
'Access-Control-Allow-Methods': 'OPTIONS,GET,POST,PUT,DELETE',
'Access-Control-Allow-Headers':
'Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With',
Authorization: '',
},
withCredentials: true,
credentials: 'same-origin',
}
)
data.push({ ccy: 'UAH', buy: '1', sale: '1' })
data.splice(2, 1)
return data
} catch (error) {
alert(error)
}
}
Help please :)
tried many solutions from google but to no avail...