aboutsummaryrefslogtreecommitdiff
path: root/src/components/importer/importer.js
blob: 44d02c9335026bf44240b90e6a75e8cae21397d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
      this.$store.state.api.backendInteractor.followImport(this.file)
        .then((status) => {
          if (status) {
            this.success = true
          } else {
            this.error = true
          }
          this.uploading = false
        })
    },
    dismiss () {
      this.success = false
      this.error = false
    }
  }
}

export default Importer