0

我正在尝试将发布请求发送到启用了API 密钥类型授权的 url 。我可以通过邮递员发送请求。API 的响应非常好,但是当我在 Vuejs 中获取时。我无法使用 fetch 发送 POST 请求。附上邮递员的截图。 在此处输入图像描述

我在 Vuejs 中使用的尝试过的代码是:-

const requestOptions = {
      method: "POST",
      withCredentials: true,
      headers: {
        "Content-Type": "application/json",
        "X-API-Key":"3C68F15FF89132BF254E5FB648FCA",
      },
      body: JSON.stringify({
        name: this.name,
        phonenumber: this.phoneNumber,
        msg: this.message,
      }),
    };
    let response = await fetch(
      "https://auto.toxiclabs.net/webhook/d6121492-4b9c-4dc2-908f-991001b20b61",
      requestOptions
    );

我得到的错误 在此处输入图像描述

谁能告诉我我的代码到底出了什么问题?

4

0 回答 0