Fix/82 import (#83)

* fix/82-import fix import extension filter
* fix/82-import version bump
This commit is contained in:
Carlos Valente
2022-01-05 22:15:21 +01:00
committed by GitHub
parent 2fa397548a
commit c3f18feaae
2 changed files with 13 additions and 11 deletions
+12 -10
View File
@@ -40,6 +40,7 @@ export default function MenuBar(props) {
const handleUpload = (event) => {
const fileUploaded = event.target.files[0];
console.log('1', fileUploaded)
if (fileUploaded == null) return;
// Limit file size to 1MB
@@ -48,17 +49,18 @@ export default function MenuBar(props) {
return;
}
// Check file extension
if (! fileUploaded.name.endsWith('.xlsx')
|| !fileUploaded.name.endsWith('.json')) {
emitError('Error: File type unknown')
return;
}
console.log('2', ! fileUploaded.name.endsWith('.xlsx')
|| !fileUploaded.name.endsWith('.json'))
try {
uploaddb.mutate(fileUploaded);
} catch (error) {
emitError(`Failed uploading file: ${error}`)
// Check file extension
if (fileUploaded.name.endsWith('.xlsx') || fileUploaded.name.endsWith('.json')) {
try {
uploaddb.mutate(fileUploaded);
} catch (error) {
emitError(`Failed uploading file: ${error}`)
}
} else {
emitError('Error: File type unknown')
}
// reset input value
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "ontime",
"version": "0.5.0",
"version": "0.5.1",
"author": "Carlos Valente",
"description": "Time keeping for live events",
"repository": "https://github.com/cpvalente/ontime",