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:
mgabdev
2021-01-13 23:51:44 -05:00
parent 1ed29ddd53
commit fb75f33b12
5 changed files with 24 additions and 14 deletions

View File

@@ -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))

View File

@@ -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))