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

33 lines
1.3 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
import { doClearEmailEntry, doUserSignUp } from 'redux/actions/user';
import {
selectEmailNewIsPending,
selectEmailNewErrorMessage,
selectEmailAlreadyExists,
selectUser,
} from 'redux/selectors/user';
import * as SETTINGS from 'constants/settings';
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
import { doSetWalletSyncPreference, doSetDaemonSetting } from 'redux/actions/settings';
import { selectDaemonSettings, selectClientSetting } from 'redux/selectors/settings';
import UserEmailNew from './view';
2021-03-19 21:52:59 +01:00
const select = (state) => ({
isPending: selectEmailNewIsPending(state),
errorMessage: selectEmailNewErrorMessage(state),
syncEnabled: selectClientSetting(state, SETTINGS.ENABLE_SYNC),
daemonSettings: selectDaemonSettings(state),
emailExists: selectEmailAlreadyExists(state),
user: selectUser(state),
2017-06-10 19:17:37 +02:00
});
2021-03-19 21:52:59 +01:00
const perform = (dispatch) => ({
setSync: (value) => dispatch(doSetWalletSyncPreference(value)),
setShareDiagnosticData: (shouldShareData) =>
dispatch(doSetDaemonSetting(DAEMON_SETTINGS.SHARE_USAGE_DATA, shouldShareData)),
doSignUp: (email, password) => dispatch(doUserSignUp(email, password)),
clearEmailEntry: () => dispatch(doClearEmailEntry()),
2017-06-10 19:17:37 +02:00
});
export default connect(select, perform)(UserEmailNew);