Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
readAsDataURL(file[0]).then(data => {
const fields = data.match(/^data:(.*);(.*),(.*)$/);
this.props.createContent(getBaseUrl(this.props.pathname), {
'@type': 'Image',
title: file[0].name,
image: {
data: fields[3],
encoding: fields[2],
'content-type': fields[1],
filename: file[0].name,
},
});
});
};
<>
{data?.query?.length === 0 && (
{message => <p>{message}</p>}
)}
{data?.query?.length > 0 && (
{message => <p>{message}</p>}
)}
);
};
readAsDataURL(file).then(data => {
const fields = data.match(/^data:(.*);(.*),(.*)$/);
this.props.createContent(getBaseUrl(this.props.pathname), {
'@type': 'Image',
image: {
data: fields[3],
encoding: fields[2],
'content-type': fields[1],
filename: file.name,
},
});
});
}
readAsDataURL(file).then(data => {
const fields = data.match(/^data:(.*);(.*),(.*)$/);
this.props.createContent(getBaseUrl(this.props.pathname), {
'@type': 'Image',
image: {
data: fields[3],
encoding: fields[2],
'content-type': fields[1],
filename: file.name,
},
});
});
}