Добрый день. Не могу отправить post запрос через vue-resource или axios, в обоих случая ошибка : Access to XMLHttpRequest at '
https://api.bitaps.com/btc/v1/create/payment/address' from origin '
localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
Нашел инфу про заголовки
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PATCH, PUT, DELETE, OPTIONS',
'Access-Control-Allow-Headers': 'Origin, Content-Type, X-Auth-Token'
но все равно такая же ошибка.
Код компонента
<template>
<div class="container">
<div class="row">
<div class="col text-center mt-5">
<button class="btn btn-lg btn-success" type="button" v-on:click="getBtcAddress">Get Btc</button>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
forwarding_address: '18Hh2hEY8cV4mk9dQwjzyjkEzrUgMY71Kv',
callback_link: 'http://www.2qgsl7gnaiiypmda.onion/handler',
confirmations: 2
}
},
methods: {
getBtcAddress: function() {
const options = {
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PATCH, PUT, DELETE, OPTIONS',
'Access-Control-Allow-Headers': 'Origin, Content-Type, X-Auth-Token'
}
}
this.axios.post('https://api.bitaps.com/btc/v1/create/payment/address', {forwarding_address: this.forwarding_address, callback_link: this.callback_link, confirmations: this.confirmations}, options).then((response) => {
console.log(response.data)
})
}
}
}
</script>