lbry-desktop/ui/page/invite/index.js
infinite-persistence 7fc66aecb6 Defer user/invite_status from startup
## Issue
Closes 385

## Approach
As mentioned in the ticket, the current places where that info is needed is in the Invites Page and Social Share Component.

1. Invites Page: it is already doing the fetch on mount, so no issue there.
2. Social Share: show spinner until the data is fetched.
2022-01-21 09:19:17 -05:00

25 lines
975 B
JavaScript

import * as SETTINGS from 'constants/settings';
import { connect } from 'react-redux';
import {
selectUserInviteStatusFailed,
selectUserInviteStatusIsPending,
selectUserVerifiedEmail,
} from 'redux/selectors/user';
import { doFetchInviteStatus } from 'redux/actions/user';
import { selectClientSetting } from 'redux/selectors/settings';
import { doSetClientSetting } from 'redux/actions/settings';
import InvitePage from './view';
const select = (state) => ({
isFailed: selectUserInviteStatusFailed(state),
isPending: selectUserInviteStatusIsPending(state),
inviteAcknowledged: selectClientSetting(state, SETTINGS.INVITE_ACKNOWLEDGED),
authenticated: selectUserVerifiedEmail(state),
});
const perform = (dispatch) => ({
fetchInviteStatus: (callRewardList) => dispatch(doFetchInviteStatus(callRewardList)),
acknowledgeInivte: () => dispatch(doSetClientSetting(SETTINGS.INVITE_ACKNOWLEDGED, true)),
});
export default connect(select, perform)(InvitePage);