lbry-desktop/ui/component/userSignIn/index.js

56 lines
1.7 KiB
JavaScript
Raw Normal View History

import * as SETTINGS from 'constants/settings';
2019-08-27 16:43:42 +02:00
import { connect } from 'react-redux';
import {
selectEmailToVerify,
selectUser,
selectAccessToken,
2019-09-26 18:07:11 +02:00
makeSelectIsRewardClaimPending,
selectClaimedRewards,
rewards as REWARD_TYPES,
doClaimRewardType,
doUserFetch,
selectUserIsPending,
selectYoutubeChannels,
selectGetSyncIsPending,
selectGetSyncErrorMessage,
selectSyncHash,
2019-08-27 16:43:42 +02:00
} from 'lbryinc';
2019-10-03 23:40:54 +02:00
import { selectMyChannelClaims, selectBalance, selectFetchingMyChannels, selectCreatingChannel } from 'lbry-redux';
import { makeSelectClientSetting } from 'redux/selectors/settings';
2019-09-26 18:07:11 +02:00
import UserSignIn from './view';
2019-08-27 16:43:42 +02:00
const select = state => ({
emailToVerify: selectEmailToVerify(state),
2019-08-27 16:43:42 +02:00
user: selectUser(state),
accessToken: selectAccessToken(state),
2019-09-26 18:07:11 +02:00
channels: selectMyChannelClaims(state),
claimedRewards: selectClaimedRewards(state),
claimingReward: makeSelectIsRewardClaimPending()(state, {
reward_type: REWARD_TYPES.TYPE_CONFIRM_EMAIL,
}),
balance: selectBalance(state),
fetchingChannels: selectFetchingMyChannels(state),
youtubeChannels: selectYoutubeChannels(state),
userFetchPending: selectUserIsPending(state),
syncEnabled: makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state),
2019-09-27 20:56:15 +02:00
syncingWallet: selectGetSyncIsPending(state),
getSyncError: selectGetSyncErrorMessage(state),
2019-09-27 20:56:15 +02:00
hasSynced: Boolean(selectSyncHash(state)),
2019-10-03 23:40:54 +02:00
creatingChannel: selectCreatingChannel(state),
2019-08-27 16:43:42 +02:00
});
const perform = dispatch => ({
fetchUser: () => dispatch(doUserFetch()),
2019-09-26 18:07:11 +02:00
claimReward: () =>
dispatch(
doClaimRewardType(REWARD_TYPES.TYPE_CONFIRM_EMAIL, {
notifyError: false,
})
),
2019-08-27 16:43:42 +02:00
});
export default connect(
select,
perform
2019-09-26 18:07:11 +02:00
)(UserSignIn);