Updated account, groups relationships routes to post data instead of get
• Updated: - account, groups relationships routes to post data instead of get
This commit is contained in:
@@ -542,7 +542,9 @@ export const fetchRelationships = (accountIds) => (dispatch, getState) => {
|
||||
|
||||
dispatch(fetchRelationshipsRequest(newAccountIds))
|
||||
|
||||
api(getState).get(`/api/v1/accounts/relationships?${newAccountIds.map(id => `id[]=${id}`).join('&')}`).then((response) => {
|
||||
api(getState).post('/api/v1/accounts/relationships', {
|
||||
accountIds: newAccountIds,
|
||||
}).then((response) => {
|
||||
dispatch(fetchRelationshipsSuccess(response.data))
|
||||
}).catch((error) => {
|
||||
dispatch(fetchRelationshipsFail(error))
|
||||
|
||||
@@ -182,13 +182,18 @@ export const fetchGroupRelationships = (groupIds) => (dispatch, getState) => {
|
||||
if (!me || !Array.isArray(groupIds)) return
|
||||
|
||||
const loadedRelationships = getState().get('group_relationships')
|
||||
const newGroupIds = groupIds.filter((id) => loadedRelationships.get(id, null) === null)
|
||||
let newGroupIds = groupIds.filter((id) => loadedRelationships.get(id, null) === null)
|
||||
|
||||
if (newGroupIds.length === 0) return
|
||||
|
||||
// Unique
|
||||
newGroupIds = Array.from(new Set(newGroupIds))
|
||||
|
||||
dispatch(fetchGroupRelationshipsRequest(newGroupIds))
|
||||
|
||||
api(getState).get(`/api/v1/groups/${newGroupIds[0]}/relationships?${newGroupIds.map(id => `id[]=${id}`).join('&')}`).then((response) => {
|
||||
api(getState).post('/api/v1/group_relationships', {
|
||||
groupIds: newGroupIds,
|
||||
}).then((response) => {
|
||||
dispatch(fetchGroupRelationshipsSuccess(response.data))
|
||||
}).catch((error) => {
|
||||
dispatch(fetchGroupRelationshipsFail(error))
|
||||
|
||||
Reference in New Issue
Block a user