Add follow import to user settings.

This commit is contained in:
eal 2017-12-23 16:44:22 +02:00
parent 8f3926a096
commit a058941aed
5 changed files with 67 additions and 4 deletions

View file

@ -5,7 +5,10 @@ const UserSettings = {
return {
newname: this.$store.state.users.currentUser.name,
newbio: this.$store.state.users.currentUser.description,
uploading: [ false, false, false ],
followList: null,
followImportError: false,
followsImported: false,
uploading: [ false, false, false, false ],
previews: [ null, null, null ]
}
},
@ -15,6 +18,9 @@ const UserSettings = {
computed: {
user () {
return this.$store.state.users.currentUser
},
pleromaBackend () {
return this.$store.state.config.pleromaBackend
}
},
methods: {
@ -117,6 +123,29 @@ const UserSettings = {
}
this.uploading[2] = false
})
},
importFollows () {
this.uploading[3] = true
const followList = this.followList
this.$store.state.api.backendInteractor.followImport({params: followList})
.then((status) => {
if (status) {
this.followsImported = true
} else {
this.followImportError = true
}
this.uploading[3] = false
})
},
followListChange () {
// eslint-disable-next-line no-undef
let formData = new FormData()
formData.append('list', this.$refs.followlist.files[0])
this.followList = formData
},
dismissImported () {
this.followsImported = false
this.followImportError = false
}
}
}