2017-12-21 18:08:54 -03:00
|
|
|
import { connect } from 'react-redux';
|
2019-10-16 18:03:11 -04:00
|
|
|
import {
|
2022-04-15 00:05:59 -03:00
|
|
|
selectIsFetchingAllMyClaims,
|
2020-04-24 09:51:00 -04:00
|
|
|
selectFetchingMyClaimsPageError,
|
2022-04-15 00:05:59 -03:00
|
|
|
selectAllMyClaims,
|
2021-10-07 23:47:39 -04:00
|
|
|
} from 'redux/selectors/claims';
|
2022-04-15 00:05:59 -03:00
|
|
|
import { doCheckPendingClaims, doFetchAllClaimListMine } from 'redux/actions/claims';
|
2021-10-07 23:47:39 -04:00
|
|
|
import { doClearPublish } from 'redux/actions/publish';
|
2017-12-21 18:08:54 -03:00
|
|
|
import FileListPublished from './view';
|
2019-09-23 13:32:38 -04:00
|
|
|
import { withRouter } from 'react-router';
|
2020-05-11 11:54:39 -04:00
|
|
|
import { MY_CLAIMS_PAGE_SIZE, PAGE_PARAM, PAGE_SIZE_PARAM } from 'constants/claim';
|
2017-04-23 23:10:45 +07:00
|
|
|
|
2019-09-23 13:32:38 -04:00
|
|
|
const select = (state, props) => {
|
|
|
|
const { search } = props.location;
|
|
|
|
const urlParams = new URLSearchParams(search);
|
2020-04-24 09:51:00 -04:00
|
|
|
const page = Number(urlParams.get(PAGE_PARAM)) || '1';
|
2020-05-11 11:54:39 -04:00
|
|
|
const pageSize = urlParams.get(PAGE_SIZE_PARAM) || String(MY_CLAIMS_PAGE_SIZE);
|
2022-04-15 00:05:59 -03:00
|
|
|
const initialSearchTerm = urlParams.get('searchText') || '';
|
2020-04-24 09:51:00 -04:00
|
|
|
|
2019-09-23 13:32:38 -04:00
|
|
|
return {
|
|
|
|
page,
|
2020-04-24 09:51:00 -04:00
|
|
|
pageSize,
|
2022-04-15 00:05:59 -03:00
|
|
|
fetching: selectIsFetchingAllMyClaims(state),
|
2020-04-24 09:51:00 -04:00
|
|
|
error: selectFetchingMyClaimsPageError(state),
|
2022-04-15 00:05:59 -03:00
|
|
|
myClaims: selectAllMyClaims(state),
|
|
|
|
initialSearchTerm,
|
2019-09-23 13:32:38 -04:00
|
|
|
};
|
|
|
|
};
|
2017-05-01 11:51:19 +07:00
|
|
|
|
2021-03-15 17:59:48 +08:00
|
|
|
const perform = (dispatch) => ({
|
2020-07-23 10:22:57 -04:00
|
|
|
checkPendingPublishes: () => dispatch(doCheckPendingClaims()),
|
2020-01-07 23:29:01 -06:00
|
|
|
clearPublish: () => dispatch(doClearPublish()),
|
2022-04-15 00:05:59 -03:00
|
|
|
fetchAllMyClaims: () => dispatch(doFetchAllClaimListMine()),
|
2017-06-05 21:21:55 -07:00
|
|
|
});
|
2017-05-01 11:51:19 +07:00
|
|
|
|
2020-04-24 09:51:00 -04:00
|
|
|
export default withRouter(connect(select, perform)(FileListPublished));
|