diff --git a/src/components/ImportModal.vue b/src/components/ImportModal.vue
index fc859c6..f3a3917 100644
--- a/src/components/ImportModal.vue
+++ b/src/components/ImportModal.vue
@@ -46,9 +46,9 @@ export default {
close() {
this.isOpen = false;
},
- onSelected(content) {
+ onSelected(payload) {
try {
- const data = JSON.parse(content);
+ const data = JSON.parse(payload.content);
this.$store.dispatch('data/importJson', data);
this.close();
diff --git a/src/components/form/AppFileInput.vue b/src/components/form/AppFileInput.vue
index 928a437..9b50b35 100644
--- a/src/components/form/AppFileInput.vue
+++ b/src/components/form/AppFileInput.vue
@@ -3,7 +3,8 @@
-
+
@@ -15,6 +16,10 @@ export default {
buttonText: {
default: 'Select file',
},
+ outputType: {
+ default: 'text',
+ },
+ accept: {},
},
data() {
return {
@@ -28,10 +33,18 @@ export default {
const reader = new FileReader();
reader.onload = (e) => {
- this.$emit('selected', e.target.result);
+ this.$emit('selected', {
+ content: e.target.result,
+ mime: file.type,
+ size: file.size,
+ });
this.reset();
};
- reader.readAsText(file);
+ if (this.outputType === 'text') {
+ reader.readAsText(file);
+ } else if (this.outputType === 'base64') {
+ reader.readAsDataURL(file);
+ }
},
reset() {
this.ready = false;
diff --git a/src/components/invoices/InvoiceForm.vue b/src/components/invoices/InvoiceForm.vue
index aef5eb6..b73bc59 100644
--- a/src/components/invoices/InvoiceForm.vue
+++ b/src/components/invoices/InvoiceForm.vue
@@ -6,10 +6,14 @@
-