38f511c2fb
`publish` is currently rehydrated, so we can ride on that and don't need to store the `currentUploads` in `localStorage` for persistence. This would allow us to store Markdown Post data too, as `localStorage` has a 5MB limit per app. We could have also made `webReducer` rehydrate, but in this repo, there is no need to split it to another reducer. It also makes more sense to be part of publish anyway (at least to me). This change is mostly moving items between files, with the exception of 1. An additional REHYDRATE in the publish reducer to clean up the tusUploader. 2. Not clearing `currentUploads` in CLEAR_PUBLISH.
39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import {
|
|
selectIsFetchingClaimListMine,
|
|
selectMyClaimsPage,
|
|
selectMyClaimsPageItemCount,
|
|
selectFetchingMyClaimsPageError,
|
|
} from 'redux/selectors/claims';
|
|
import { selectUploadCount } from 'redux/selectors/publish';
|
|
import { doFetchClaimListMine, doCheckPendingClaims } from 'redux/actions/claims';
|
|
import { doClearPublish } from 'redux/actions/publish';
|
|
import FileListPublished from './view';
|
|
import { withRouter } from 'react-router';
|
|
import { MY_CLAIMS_PAGE_SIZE, PAGE_PARAM, PAGE_SIZE_PARAM } from 'constants/claim';
|
|
|
|
const select = (state, props) => {
|
|
const { search } = props.location;
|
|
const urlParams = new URLSearchParams(search);
|
|
const page = Number(urlParams.get(PAGE_PARAM)) || '1';
|
|
const pageSize = urlParams.get(PAGE_SIZE_PARAM) || String(MY_CLAIMS_PAGE_SIZE);
|
|
|
|
return {
|
|
page,
|
|
pageSize,
|
|
fetching: selectIsFetchingClaimListMine(state),
|
|
urls: selectMyClaimsPage(state),
|
|
urlTotal: selectMyClaimsPageItemCount(state),
|
|
error: selectFetchingMyClaimsPageError(state),
|
|
uploadCount: selectUploadCount(state),
|
|
};
|
|
};
|
|
|
|
const perform = (dispatch) => ({
|
|
checkPendingPublishes: () => dispatch(doCheckPendingClaims()),
|
|
fetchClaimListMine: (page, pageSize, resolve, filterBy) =>
|
|
dispatch(doFetchClaimListMine(page, pageSize, resolve, filterBy)),
|
|
clearPublish: () => dispatch(doClearPublish()),
|
|
});
|
|
|
|
export default withRouter(connect(select, perform)(FileListPublished));
|