Updated ListsAccountsController to check if account blocks current_account

• Updated:
- ListsAccountsController to check if account blocks current_account
- Lists action and controller to only allow singular account_id instead of array
This commit is contained in:
mgabdev
2020-12-31 19:17:55 -05:00
parent af7c82221d
commit 5b852ae10e
2 changed files with 13 additions and 15 deletions

View File

@@ -341,7 +341,7 @@ export const addToList = (listId, accountId) => (dispatch, getState) => {
dispatch(addToListRequest(listId, accountId))
api(getState).post(`/api/v1/lists/${listId}/accounts`, { account_ids: [accountId] })
api(getState).post(`/api/v1/lists/${listId}/accounts`, { account_id: accountId })
.then(() => dispatch(addToListSuccess(listId, accountId)))
.catch((err) => dispatch(addToListFail(listId, accountId, err)))
}
@@ -382,7 +382,7 @@ export const removeFromList = (listId, accountId) => (dispatch, getState) => {
dispatch(removeFromListRequest(listId, accountId))
api(getState).delete(`/api/v1/lists/${listId}/accounts`, { params: { account_ids: [accountId] } })
api(getState).delete(`/api/v1/lists/${listId}/accounts`, { params: { account_id: accountId } })
.then(() => dispatch(removeFromListSuccess(listId, accountId)))
.catch((err) => dispatch(removeFromListFail(listId, accountId, err)))
}