split out follow’s importer as a separate component
This commit is contained in:
parent
9e2fa50b74
commit
562120ae48
4 changed files with 59 additions and 41 deletions
36
src/components/importer/importer.js
Normal file
36
src/components/importer/importer.js
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue