Add blocks.

This commit is contained in:
eal 2017-11-07 22:38:28 +02:00
parent 7ab7ac7be6
commit 608d1e6776
4 changed files with 54 additions and 0 deletions

View file

@ -26,6 +26,8 @@ const BANNER_UPDATE_URL = '/api/account/update_profile_banner.json'
const PROFILE_UPDATE_URL = '/api/account/update_profile.json'
const EXTERNAL_PROFILE_URL = '/api/externalprofile/show.json'
const QVITTER_USER_TIMELINE_URL = '/api/qvitter/statuses/user_timeline.json'
const BLOCKING_URL = '/api/blocks/create.json'
const UNBLOCKING_URL = '/api/blocks/destroy.json'
// const USER_URL = '/api/users/show.json'
import { each, map } from 'lodash'
@ -184,6 +186,22 @@ const unfollowUser = ({id, credentials}) => {
}).then((data) => data.json())
}
const blockUser = ({id, credentials}) => {
let url = `${BLOCKING_URL}?user_id=${id}`
return fetch(url, {
headers: authHeaders(credentials),
method: 'POST'
}).then((data) => data.json())
}
const unblockUser = ({id, credentials}) => {
let url = `${UNBLOCKING_URL}?user_id=${id}`
return fetch(url, {
headers: authHeaders(credentials),
method: 'POST'
}).then((data) => data.json())
}
const fetchFriends = ({id, credentials}) => {
let url = `${FRIENDS_URL}?user_id=${id}`
return fetch(url, { headers: authHeaders(credentials) })
@ -343,6 +361,8 @@ const apiService = {
fetchFollowers,
followUser,
unfollowUser,
blockUser,
unblockUser,
favorite,
unfavorite,
retweet,