aboutsummaryrefslogtreecommitdiff
path: root/src/components/importer/importer.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/importer/importer.js')
-rw-r--r--src/components/importer/importer.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/components/importer/importer.js b/src/components/importer/importer.js
new file mode 100644
index 00000000..8d6c8b3f
--- /dev/null
+++ b/src/components/importer/importer.js
@@ -0,0 +1,36 @@
+const Importer = {
+ data () {
+ return {
+ file: null,
+ error: false,
+ success: false,
+ uploading: false
+ }
+ },
+ methods: {
+ change () {
+ this.file = this.$refs.input.files[0]
+ },
+ submit () {
+ this.uploading = true
+ // eslint-disable-next-line no-undef
+ const formData = new FormData()
+ formData.append('list', this.file)
+ this.$store.state.api.backendInteractor.followImport({params: formData})
+ .then((status) => {
+ if (status) {
+ this.success = true
+ } else {
+ this.error = true
+ }
+ this.uploading = false
+ })
+ },
+ dismiss () {
+ this.success = false
+ this.error = false
+ }
+ }
+}
+
+export default Importer