forked from AkkomaGang/akkoma-fe
#315 - export all follows as CSV
This commit is contained in:
parent
6a867f6ae3
commit
2f12ac7ea4
3 changed files with 10 additions and 4 deletions
src
components/user_settings
services
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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}) => {
|
||||
|
|
Loading…
Reference in a new issue