2

我正在Component为我的瑜伽App建立一个自定义活动日历codesandbox。实际上我打算在我的 . 上做IDE,但想法开始很快就开始了,我最终使用了它。

我试图从使用中获取widthand然后尝试访问暗淡,就像这个解决方案一样。height<div/>ref={(el) => this.props.testing((this.container = el))componentDidMount()

突然我开始收到以下错误codesandbox

TypeError

Failed to fetch

This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.
This error overlay is powered by `react-error-overlay` used in `create-react-app`.

在控制台上:

Failed to load resource: net::ERR_CERT_COMMON_NAME_INVALID

(index):1 Uncaught (in promise) TypeError: Failed to fetch

(index):1 Access to fetch at 'https://codesandbox.io/api/v1/sandboxes/wm1dl/cache' from origin
'https://wm1dl.codesandbox.io' has been blocked by CORS policy: Response to preflight request
doesn't pass access control check: 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 with CORS disabled.

codesandbox.io/api/v1/sandboxes/wm1dl/cache:1 Failed to load resource: net::ERR_FAILED

我尝试检查我的网络和其他东西,但我不知道如何标准化。

我需要对此进行规范化,或者至少能够确保我可以安全地将我的文件复制/提交到 github,然后在我的 IDE 上使用它。

这是我的沙盒

4

2 回答 2

3

显然我们很多人都遇到了这个问题。这应该最终消失..

它不是一个拦截器。你可以关闭模​​式。就这样

在此处输入图像描述

于 2020-03-25T03:55:43.823 回答
1

https当使用 访问代码和框并且您正在进行的 fetch 调用正在使用 时,可能会发生此错误http。更改 fetch api 调用以https解决此问题

于 2021-06-06T06:47:35.400 回答