fetch my claims on wallet page so reposts are deleteable
This commit is contained in:
parent
09dba29333
commit
3ad923b4f8
2 changed files with 31 additions and 18 deletions
|
@ -1,15 +1,22 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doFetchTransactions, makeSelectLatestTransactions } from 'lbry-redux';
|
||||
import {
|
||||
doFetchTransactions,
|
||||
makeSelectLatestTransactions,
|
||||
doFetchClaimListMine,
|
||||
selectMyClaimsWithoutChannels,
|
||||
} from 'lbry-redux';
|
||||
import TransactionListRecent from './view';
|
||||
|
||||
const select = state => {
|
||||
return {
|
||||
transactions: makeSelectLatestTransactions(state),
|
||||
myClaims: selectMyClaimsWithoutChannels(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = dispatch => ({
|
||||
fetchTransactions: (page, pageSize) => dispatch(doFetchTransactions(page, pageSize)),
|
||||
fetchClaimListMine: () => dispatch(doFetchClaimListMine()),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
|
|
|
@ -5,31 +5,37 @@ import { TX_LIST } from 'lbry-redux';
|
|||
|
||||
type Props = {
|
||||
fetchTransactions: (number, number) => void,
|
||||
fetchClaimListMine: () => void,
|
||||
fetchingTransactions: boolean,
|
||||
hasTransactions: boolean,
|
||||
transactions: Array<Transaction>,
|
||||
myClaims: ?Array<StreamClaim>,
|
||||
};
|
||||
|
||||
class TransactionListRecent extends React.PureComponent<Props> {
|
||||
componentDidMount() {
|
||||
const { fetchTransactions } = this.props;
|
||||
function TransactionListRecent(props: Props) {
|
||||
const { transactions, fetchTransactions, myClaims, fetchClaimListMine } = props;
|
||||
|
||||
React.useEffect(() => {
|
||||
fetchTransactions(1, TX_LIST.LATEST_PAGE_SIZE);
|
||||
}
|
||||
}, [fetchTransactions]);
|
||||
|
||||
render() {
|
||||
const { transactions } = this.props;
|
||||
return (
|
||||
<section className="card">
|
||||
<TransactionList
|
||||
slim
|
||||
title={__('Latest Transactions')}
|
||||
transactions={transactions}
|
||||
emptyMessage={__("Looks like you don't have any transactions.")}
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
const myClaimsString = myClaims && myClaims.map(channel => channel.permanent_url).join(',');
|
||||
React.useEffect(() => {
|
||||
if (myClaimsString === '') {
|
||||
fetchClaimListMine();
|
||||
}
|
||||
}, [myClaimsString, fetchClaimListMine]);
|
||||
|
||||
return (
|
||||
<section className="card">
|
||||
<TransactionList
|
||||
slim
|
||||
title={__('Latest Transactions')}
|
||||
transactions={transactions}
|
||||
emptyMessage={__("Looks like you don't have any transactions.")}
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export default TransactionListRecent;
|
||||
|
|
Loading…
Add table
Reference in a new issue