remove status from group ui

This commit is contained in:
2458773093
2019-07-17 01:42:26 +03:00
parent caaa9253d6
commit 62b1707a85
5 changed files with 68 additions and 3 deletions

View File

@@ -47,6 +47,10 @@ export const GROUP_REMOVED_ACCOUNTS_CREATE_REQUEST = 'GROUP_REMOVED_ACCOUNTS_CRE
export const GROUP_REMOVED_ACCOUNTS_CREATE_SUCCESS = 'GROUP_REMOVED_ACCOUNTS_CREATE_SUCCESS';
export const GROUP_REMOVED_ACCOUNTS_CREATE_FAIL = 'GROUP_REMOVED_ACCOUNTS_CREATE_FAIL';
export const GROUP_REMOVE_STATUS_REQUEST = 'GROUP_REMOVE_STATUS_REQUEST';
export const GROUP_REMOVE_STATUS_SUCCESS = 'GROUP_REMOVE_STATUS_SUCCESS';
export const GROUP_REMOVE_STATUS_FAIL = 'GROUP_REMOVE_STATUS_FAIL';
export const fetchGroup = id => (dispatch, getState) => {
if (!me) return;
@@ -478,4 +482,43 @@ export function createRemovedAccountFail(groupId, id, error) {
id,
error,
};
};
export function groupRemoveStatus(groupId, id) {
return (dispatch, getState) => {
if (!me) return;
dispatch(groupRemoveStatusRequest(groupId, id));
api(getState).delete(`/api/v1/groups/${groupId}/statuses/${id}`).then(response => {
dispatch(groupRemoveStatusSuccess(groupId, id));
}).catch(error => {
dispatch(groupRemoveStatusFail(groupId, id, error));
});
};
};
export function groupRemoveStatusRequest(groupId, id) {
return {
type: GROUP_REMOVE_STATUS_REQUEST,
groupId,
id,
};
};
export function groupRemoveStatusSuccess(groupId, id) {
return {
type: GROUP_REMOVE_STATUS_SUCCESS,
groupId,
id,
};
};
export function groupRemoveStatusFail(groupId, id, error) {
return {
type: GROUP_REMOVE_STATUS_FAIL,
groupId,
id,
error,
};
};