- Use `finally` instead of an arbitrary timer to clear the spinner when resolving the claim. - Move away from `makeSelect*` - `perform`: use object form as there is no customization. - Effect-dependency cleanup.
30 lines
1 KiB
JavaScript
30 lines
1 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import { doReportContent } from 'redux/actions/reportContent';
|
|
import { selectActiveChannelClaim, selectIncognito } from 'redux/selectors/app';
|
|
import { selectIsReportingContent, selectReportContentError } from 'redux/selectors/reportContent';
|
|
import { doClaimSearch } from 'redux/actions/claims';
|
|
import { selectClaimForClaimId } from 'redux/selectors/claims';
|
|
import { withRouter } from 'react-router';
|
|
import ReportContent from './view';
|
|
|
|
const select = (state, props) => {
|
|
const { search } = props.location;
|
|
const urlParams = new URLSearchParams(search);
|
|
const claimId = urlParams.get('claimId');
|
|
|
|
return {
|
|
isReporting: selectIsReportingContent(state),
|
|
error: selectReportContentError(state),
|
|
activeChannelClaim: selectActiveChannelClaim(state),
|
|
incognito: selectIncognito(state),
|
|
claimId: claimId,
|
|
claim: selectClaimForClaimId(state, claimId),
|
|
};
|
|
};
|
|
|
|
const perform = {
|
|
doClaimSearch,
|
|
doReportContent,
|
|
};
|
|
|
|
export default withRouter(connect(select, perform)(ReportContent));
|