const projectId = 'xx';
const projectSecret = 'xx';
const auth = `Basic ${Buffer.from(`${projectId}:${projectSecret}`).toString('base64')}`;
const client = create({
host: 'ipfs.infura.io',
port: 5001,
protocol: 'https',
apiPath: '/api/v0',
headers: {
authorization: auth,
},
});
this is the createItem function
async function createItem() {
const {name, description, price} = formInput
if (!name || !description || !price || !fileUrl) return
const data = JSON.stringify({
name, description, image: fileUrl
})
try {
const added = await client.add(data)
const url = `https://ipfs.infura.io/ipfs/${added.path}`
createSale(url)
} catch (error) {
console.log('Error uploading file: ', error);
}
}
i am getting and error of request failed status code 400