forked from srxl/akkoma-fe
Merge branch 'issue-315-csv-export' into 'develop'
#315 - export all follows as CSV See merge request pleroma/pleroma-fe!538
This commit is contained in:
commit
05ef0432d3
3 changed files with 16 additions and 1 deletions
|
@ -238,7 +238,9 @@ const UserSettings = {
|
|||
exportFollows () {
|
||||
this.enableFollowsExport = false
|
||||
this.$store.state.api.backendInteractor
|
||||
.fetchFriends({id: this.$store.state.users.currentUser.id})
|
||||
.exportFriends({
|
||||
id: this.$store.state.users.currentUser.id
|
||||
})
|
||||
.then((friendList) => {
|
||||
this.exportPeople(friendList, 'friends.csv')
|
||||
setTimeout(() => { this.enableFollowsExport = true }, 2000)
|
||||
|
|
|
@ -257,6 +257,13 @@ const fetchFriends = ({id, page, credentials}) => {
|
|||
.then((data) => data.map(parseUser))
|
||||
}
|
||||
|
||||
const exportFriends = ({id, credentials}) => {
|
||||
let url = `${FRIENDS_URL}?user_id=${id}&export=true`
|
||||
return fetch(url, { headers: authHeaders(credentials) })
|
||||
.then((data) => data.json())
|
||||
.then((data) => data.map(parseUser))
|
||||
}
|
||||
|
||||
const fetchFollowers = ({id, page, credentials}) => {
|
||||
let url = `${FOLLOWERS_URL}?user_id=${id}`
|
||||
if (page) {
|
||||
|
@ -536,6 +543,7 @@ const apiService = {
|
|||
fetchConversation,
|
||||
fetchStatus,
|
||||
fetchFriends,
|
||||
exportFriends,
|
||||
fetchFollowers,
|
||||
followUser,
|
||||
unfollowUser,
|
||||
|
|
|
@ -14,6 +14,10 @@ const backendInteractorService = (credentials) => {
|
|||
return apiService.fetchFriends({id, page, credentials})
|
||||
}
|
||||
|
||||
const exportFriends = ({id}) => {
|
||||
return apiService.exportFriends({id, credentials})
|
||||
}
|
||||
|
||||
const fetchFollowers = ({id, page}) => {
|
||||
return apiService.fetchFollowers({id, page, credentials})
|
||||
}
|
||||
|
@ -78,6 +82,7 @@ const backendInteractorService = (credentials) => {
|
|||
fetchStatus,
|
||||
fetchConversation,
|
||||
fetchFriends,
|
||||
exportFriends,
|
||||
fetchFollowers,
|
||||
followUser,
|
||||
unfollowUser,
|
||||
|
|
Loading…
Reference in a new issue