我正在尝试使用其API将订户添加到Doppler的列表中,但它不断反复抛出CORS错误:
CORS Header 'Access-Control-Allow-Origin' is missing
发布数据的方式是下一个:
let options = {
method: 'POST',
url: `https://restapi.fromdoppler.com/accounts/${this.dopplerEmail}/lists/${this.dopplerNewsletterId}/subscribers`,
params: {
"email": this.email,
"fields": [
{
"name": "FIRSTNAME",
"value": this.name,
"predefined": true,
"private": true,
"readonly": true,
"type": "string"
},
{
"name": "BIRTHDAY",
"value": this.birthday,
"predefined": true,
"private": false,
"readonly": false,
"type": "date"
},
{
"name": "CONSENT",
"value": "True",
"predefined": true,
"private": false,
"readonly": false,
"type": "consent"
}
]
},
headers: {
'Authorization': `token ${this.dopplerApiKey}`,
}
}
axios(options).then(r => {
... some logic
}).catch(e => {
console.log(e)
});
我所有的变量都可以,所以我认为问题出在我的帖子设置之内,但我不知道是什么。
我正在使用Laravel 5.6,整个逻辑(包括表单本身)都在VueJS组件内部。