initial draft for follows/following pagination

This commit is contained in:
shpuld 2019-01-31 21:11:28 +02:00
parent fbe7af3d56
commit 8ce513ed09
7 changed files with 34 additions and 13 deletions

View file

@ -247,15 +247,21 @@ const fetchUser = ({id, credentials}) => {
.then((data) => parseUser(data))
}
const fetchFriends = ({id, credentials}) => {
const fetchFriends = ({id, page, credentials}) => {
let url = `${FRIENDS_URL}?user_id=${id}`
if (page) {
url = url + `&page=${page}`
}
return fetch(url, { headers: authHeaders(credentials) })
.then((data) => data.json())
.then((data) => data.map(parseUser))
}
const fetchFollowers = ({id, credentials}) => {
const fetchFollowers = ({id, page, credentials}) => {
let url = `${FOLLOWERS_URL}?user_id=${id}`
if (page) {
url = url + `&page=${page}`
}
return fetch(url, { headers: authHeaders(credentials) })
.then((data) => data.json())
.then((data) => data.map(parseUser))