submitReport(): don't call getState() a million times
This commit is contained in:
parent
f92eeb333c
commit
83a0988daa
1 changed files with 6 additions and 5 deletions
|
@ -56,13 +56,14 @@ export function toggleStatusReport(statusId, checked) {
|
||||||
export function submitReport() {
|
export function submitReport() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch(submitReportRequest());
|
dispatch(submitReportRequest());
|
||||||
|
const { reports } = getState();
|
||||||
|
|
||||||
return api(getState).post('/api/v1/reports', {
|
return api(getState).post('/api/v1/reports', {
|
||||||
account_id: getState().getIn(['reports', 'new', 'account_id']),
|
account_id: reports.getIn(['new', 'account_id']),
|
||||||
status_ids: getState().getIn(['reports', 'new', 'status_ids']),
|
status_ids: reports.getIn(['new', 'status_ids']),
|
||||||
rule_ids: getState().getIn(['reports', 'new', 'rule_ids']),
|
rule_ids: reports.getIn(['new', 'rule_ids']),
|
||||||
comment: getState().getIn(['reports', 'new', 'comment']),
|
comment: reports.getIn(['new', 'comment']),
|
||||||
forward: getState().getIn(['reports', 'new', 'forward']),
|
forward: reports.getIn(['new', 'forward']),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue