i have the code shown below and it show the promise was rejected, how do i fix this issue?
async function toDataURL(url) {
const blob = await fetch(url).then(res => res.blob());
return URL.createObjectURL(blob);
}
console.log(dl('http://static1.e621proxy.ru/data/d4/07/d40742e2ec797eb810e9e40ad3afd523.png?login=rssaromeo&api_key=${mykey}'))
async function dl(u) {
const a = document.createElement("a");
a.href = await toDataURL(u);
a.download = "myImage.png";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}