diff options
| author | taehoon <th.dev91@gmail.com> | 2019-03-21 21:44:59 -0400 |
|---|---|---|
| committer | taehoon <th.dev91@gmail.com> | 2019-03-21 21:44:59 -0400 |
| commit | 8702d23a137d06607fc525b6c791abe24ed021ff (patch) | |
| tree | 77a732f146f83477bf782ae60080854827d30dda | |
| parent | 379e33f6a531fad17477c43e0112941343c737ef (diff) | |
switch to mastoapi
| -rw-r--r-- | src/modules/users.js | 6 | ||||
| -rw-r--r-- | src/services/api/api.service.js | 10 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/modules/users.js b/src/modules/users.js index ca4358ca..f12348d4 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -197,8 +197,8 @@ const users = { }, blockUser (store, userId) { return store.rootState.api.backendInteractor.blockUser(userId) - .then((blockedUser) => { - store.commit('addNewUsers', [blockedUser]) + .then((relationship) => { + store.commit('updateUserRelationship', [relationship]) store.commit('removeStatus', { timeline: 'friends', userId }) store.commit('removeStatus', { timeline: 'public', userId }) store.commit('removeStatus', { timeline: 'publicAndExternal', userId }) @@ -206,7 +206,7 @@ const users = { }, unblockUser (store, id) { return store.rootState.api.backendInteractor.unblockUser(id) - .then((user) => store.commit('addNewUsers', [user])) + .then((relationship) => store.commit('updateUserRelationship', [relationship])) }, fetchMutes (store) { return store.rootState.api.backendInteractor.fetchMutes() diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index c3f863c8..36441017 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -30,8 +30,6 @@ const PROFILE_UPDATE_URL = '/api/account/update_profile.json' const EXTERNAL_PROFILE_URL = '/api/externalprofile/show.json' const QVITTER_USER_NOTIFICATIONS_URL = '/api/qvitter/statuses/notifications.json' const QVITTER_USER_NOTIFICATIONS_READ_URL = '/api/qvitter/statuses/notifications/read.json' -const BLOCKING_URL = '/api/blocks/create.json' -const UNBLOCKING_URL = '/api/blocks/destroy.json' const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import' const DELETE_ACCOUNT_URL = '/api/pleroma/delete_account' const CHANGE_PASSWORD_URL = '/api/pleroma/change_password' @@ -46,6 +44,8 @@ const MASTODON_USER_RELATIONSHIPS_URL = '/api/v1/accounts/relationships' const MASTODON_USER_TIMELINE_URL = id => `/api/v1/accounts/${id}/statuses` const MASTODON_USER_BLOCKS_URL = '/api/v1/blocks/' const MASTODON_USER_MUTES_URL = '/api/v1/mutes/' +const MASTODON_BLOCK_USER_URL = id => `/api/v1/accounts/${id}/block` +const MASTODON_UNBLOCK_USER_URL = id => `/api/v1/accounts/${id}/unblock` import { each, map } from 'lodash' import { parseStatus, parseUser, parseNotification } from '../entity_normalizer/entity_normalizer.service.js' @@ -228,16 +228,14 @@ const unfollowUser = ({id, credentials}) => { } const blockUser = ({id, credentials}) => { - let url = `${BLOCKING_URL}?user_id=${id}` - return fetch(url, { + return fetch(MASTODON_BLOCK_USER_URL(id), { headers: authHeaders(credentials), method: 'POST' }).then((data) => data.json()) } const unblockUser = ({id, credentials}) => { - let url = `${UNBLOCKING_URL}?user_id=${id}` - return fetch(url, { + return fetch(MASTODON_UNBLOCK_USER_URL(id), { headers: authHeaders(credentials), method: 'POST' }).then((data) => data.json()) |
