const photoPromise = fetch("https://cdn.vanderbilt.edu/vu-wp0/wp-content/uploads/sites/59/2019/03/27130027/complex-300x180.png")
.then((response) => response.blob())
.then((blob) => {
const file = new File([blob], "image", { type: blob.type });
return Promise.resolve(file);
})
.catch((error) => {
return error;
});
new Promise((resolve) => resolve(photoPromise))
.then((data) => {
console.log(data);
})
.catch((error) => {
console.log(error);
});
приходит: TypeError: Failed to fetch
Access to fetch at 'https://cdn.vanderbilt.edu/vu-wp0/wp-content/uploads/sites/59/2019/03/27130027/complex-300x180.png' from origin 'null' has been blocked by CORS policy: 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.
VM581:460
GET https://cdn.vanderbilt.edu/vu-wp0/wp-content/uploads/sites/59/2019/03/27130027/complex-300x180.png net::ERR_FAILED 200 (OK)