diff options
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/api/api.service.js | 7 | ||||
| -rw-r--r-- | src/services/backend_interactor_service/backend_interactor_service.js | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 0dea2d46..47895d3b 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -11,6 +11,7 @@ const STATUS_URL = '/api/statuses/show' const MEDIA_UPLOAD_URL = '/api/statusnet/media/upload' const CONVERSATION_URL = '/api/statusnet/conversation' const MENTIONS_URL = '/api/statuses/mentions.json' +const FRIENDS_URL = '/api/statuses/friends.json' const oldfetch = window.fetch @@ -28,6 +29,11 @@ const authHeaders = (user) => { } } +const fetchFriends = ({credentials}) => { + return fetch(FRIENDS_URL, { headers: authHeaders(credentials) }) + .then((data) => data.json()) +} + const fetchMentions = ({username, sinceId = 0, credentials}) => { let url = `${MENTIONS_URL}?since_id=${sinceId}&screen_name=${username}` return fetch(url, { headers: authHeaders(credentials) }) @@ -128,6 +134,7 @@ const apiService = { fetchConversation, fetchStatus, fetchMentions, + fetchFriends, favorite, unfavorite, retweet, diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index eff085ae..36a1ff3b 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -13,10 +13,15 @@ const backendInteractorService = (credentials) => { return apiService.fetchMentions({sinceId, username, credentials}) } + const fetchFriends = () => { + return apiService.fetchFriends({credentials}) + } + const backendInteractorServiceInstance = { fetchStatus, fetchConversation, fetchMentions, + fetchFriends, verifyCredentials: apiService.verifyCredentials } |
