Uncaught TypeError: Failed to construct ‘Response’: Please use the ‘new’ operator, this DOM object constructor cannot be called as a function.
code:-
import { create as ipfsHttpClient } from ‘ipfs-http-client’
const client = ipfsHttpClient(‘https://ipfs.infura.io:5001/api/v0’);
async function onChange(e) {
const file = e.target.files[0];
try {
const added = await client.add(
file,
{
progress: (prog) => console.log(`received: ${prog}`)
}
);
const url = `https://ipfs.infura.io/ipfs/${added.path}`;
setFileUrl(url)
console.log("imageUrl", url)
} catch (error) {
console.log('Error uploading file: ', error)
}
}