mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-19 14:14:17 +00:00
Fix/82 import (#83)
* fix/82-import fix import extension filter * fix/82-import version bump
This commit is contained in:
@@ -40,6 +40,7 @@ export default function MenuBar(props) {
|
|||||||
|
|
||||||
const handleUpload = (event) => {
|
const handleUpload = (event) => {
|
||||||
const fileUploaded = event.target.files[0];
|
const fileUploaded = event.target.files[0];
|
||||||
|
console.log('1', fileUploaded)
|
||||||
if (fileUploaded == null) return;
|
if (fileUploaded == null) return;
|
||||||
|
|
||||||
// Limit file size to 1MB
|
// Limit file size to 1MB
|
||||||
@@ -48,17 +49,18 @@ export default function MenuBar(props) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check file extension
|
console.log('2', ! fileUploaded.name.endsWith('.xlsx')
|
||||||
if (! fileUploaded.name.endsWith('.xlsx')
|
|| !fileUploaded.name.endsWith('.json'))
|
||||||
|| !fileUploaded.name.endsWith('.json')) {
|
|
||||||
emitError('Error: File type unknown')
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
// Check file extension
|
||||||
uploaddb.mutate(fileUploaded);
|
if (fileUploaded.name.endsWith('.xlsx') || fileUploaded.name.endsWith('.json')) {
|
||||||
} catch (error) {
|
try {
|
||||||
emitError(`Failed uploading file: ${error}`)
|
uploaddb.mutate(fileUploaded);
|
||||||
|
} catch (error) {
|
||||||
|
emitError(`Failed uploading file: ${error}`)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
emitError('Error: File type unknown')
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset input value
|
// reset input value
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ontime",
|
"name": "ontime",
|
||||||
"version": "0.5.0",
|
"version": "0.5.1",
|
||||||
"author": "Carlos Valente",
|
"author": "Carlos Valente",
|
||||||
"description": "Time keeping for live events",
|
"description": "Time keeping for live events",
|
||||||
"repository": "https://github.com/cpvalente/ontime",
|
"repository": "https://github.com/cpvalente/ontime",
|
||||||
|
|||||||
Reference in New Issue
Block a user