I followed File upload example and this example I can now upload the file to s3. but when it comes to editing or replacing that file how should I handle that.
const CustomFile = t.irreducible('File', x => x instanceof File);
// MyModel
const BusinessModel = t.struct({
logo: t.maybe(CustomFile),
name: t.String,
}, 'BusinessModel');
// options
const options = {
fields: {
logo: {
type: 'file'
}
}
};
My response object is
{
"name": "business name",
"logo": {
"url": "https://some.url.to/s3/logo.png",
"large": {
"url": "https://some.url.to/s3/logo_large.png"
}
}
}
So how do I get response logo
to fit in BusinessModel
such that it shows preview if file exists.
onChange
it shows preview of new file
onSubmit
uploads the newly selected file
is this something that I should be considering
This is what I did I'm yet to handle the errors highlighting but this works of course for single file upload.