mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-01-20 05:12:54 +08:00
check the file type and reject non-JSON file
This commit is contained in:
parent
aaf606ba06
commit
9b70222ff9
@ -54,7 +54,11 @@ export const ImportModal: React.FC<ModalProps> = ({ visible, setVisible }) => {
|
||||
e.preventDefault();
|
||||
|
||||
if (e.type === 'drop' && e.dataTransfer.files.length) {
|
||||
setJsonFile(e.dataTransfer.files[0])
|
||||
if (e.dataTransfer.files[0].type === 'application/json') {
|
||||
setJsonFile(e.dataTransfer.files[0])
|
||||
} else {
|
||||
toast.error('Please upload JSON file!')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user