#315 - 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

View file

@ -238,7 +238,10 @@ const UserSettings = {
exportFollows () { exportFollows () {
this.enableFollowsExport = false this.enableFollowsExport = false
this.$store.state.api.backendInteractor 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) => { .then((friendList) => {
this.exportPeople(friendList, 'friends.csv') this.exportPeople(friendList, 'friends.csv')
setTimeout(() => { this.enableFollowsExport = true }, 2000) setTimeout(() => { this.enableFollowsExport = true }, 2000)

View file

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

View file

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