- export all follows as CSV

This commit is contained in:
dave 2019-02-06 11:17:23 -05:00
parent 6a867f6ae3
commit 2f12ac7ea4
3 changed files with 10 additions and 4 deletions
src
components/user_settings
services
api
backend_interactor_service

View file

@ -238,7 +238,10 @@ const UserSettings = {
exportFollows () {
this.enableFollowsExport = false
this.$store.state.api.backendInteractor
.fetchFriends({id: this.$store.state.users.currentUser.id})
.fetchFriends({
id: this.$store.state.users.currentUser.id,
isExport: true
})
.then((friendList) => {
this.exportPeople(friendList, 'friends.csv')
setTimeout(() => { this.enableFollowsExport = true }, 2000)

View file

@ -247,11 +247,14 @@ const fetchUser = ({id, credentials}) => {
.then((data) => parseUser(data))
}
const fetchFriends = ({id, page, credentials}) => {
const fetchFriends = ({id, page, isExport, credentials}) => {
let url = `${FRIENDS_URL}?user_id=${id}`
if (page) {
url = url + `&page=${page}`
}
if (isExport !== undefined) {
url = url + `&export=${isExport}`
}
return fetch(url, { headers: authHeaders(credentials) })
.then((data) => data.json())
.then((data) => data.map(parseUser))

View file

@ -10,8 +10,8 @@ const backendInteractorService = (credentials) => {
return apiService.fetchConversation({id, credentials})
}
const fetchFriends = ({id, page}) => {
return apiService.fetchFriends({id, page, credentials})
const fetchFriends = ({id, page, isExport = false}) => {
return apiService.fetchFriends({id, page, isExport, credentials})
}
const fetchFollowers = ({id, page}) => {