Toasts an error when no attritubutes atribute in a metadata file (#13)
* Toasts an error when no attritubutes atribute in a metadata file * Update MetadataModal.tsx Co-authored-by: name-user1 <eray@deuslabs.fi> Co-authored-by: findolor <anakisci@gmail.com> Co-authored-by: Serkan Reis <serkanreis@gmail.com>
This commit is contained in:
parent
f06aafcd86
commit
6816d79d64
@ -80,9 +80,11 @@ const UploadPage: NextPage = () => {
|
||||
if (event.target.files === null) return toast.error('No files selected.')
|
||||
for (let i = 0; i < event.target.files.length; i++) {
|
||||
reader = new FileReader()
|
||||
reader.onload = function (e) {
|
||||
reader.onload = async function (e) {
|
||||
if (!e.target?.result) return toast.error('Error parsing file.')
|
||||
if (!event.target.files) return toast.error('No files selected.')
|
||||
if (!JSON.parse(await event.target.files[i].text()).attributes)
|
||||
return toast.error(`The file with name '${event.target.files[i].name}' doesn't have attributes list!`)
|
||||
const metadataFile = new File([e.target.result], event.target.files[i].name, { type: 'application/json' })
|
||||
setMetadataFilesArray((prev) => [...prev, metadataFile])
|
||||
}
|
||||
@ -422,7 +424,7 @@ const UploadPage: NextPage = () => {
|
||||
metadataFile={metadataFilesArray[metadataFileArrayIndex]}
|
||||
refresher={refreshMetadata}
|
||||
updateMetadata={updateMetadataFileArray}
|
||||
updatedMetadataFile={updatedMetadataFilesArray[metadataFileArrayIndex]}
|
||||
updatedMetadataFile={updatedMetadataFilesArray[0]}
|
||||
/>
|
||||
</div>
|
||||
{imageFilesArray.length > 0 && (
|
||||
|
Loading…
Reference in New Issue
Block a user